diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt index c68285e5b..c8aa7cad6 100644 --- a/db/CMakeLists.txt +++ b/db/CMakeLists.txt @@ -2,6 +2,7 @@ # Create files from the .in files configure_file(zm_create.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" @ONLY) +configure_file(zm_update-1.31.30.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_update-1.31.30.sql" @ONLY) # Glob all database upgrade scripts file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql") @@ -9,8 +10,12 @@ file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql") # Install the database upgrade scripts install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") +# install zm_update-1.31.30.sql +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/zm_update-1.31.30.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") + # install zm_create.sql install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") # install triggers.sql install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/triggers.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") + diff --git a/db/zm_update-1.31.30.sql b/db/zm_update-1.31.30.sql.in similarity index 86% rename from db/zm_update-1.31.30.sql rename to db/zm_update-1.31.30.sql.in index c87b4409a..b6746b55a 100644 --- a/db/zm_update-1.31.30.sql +++ b/db/zm_update-1.31.30.sql.in @@ -10,10 +10,10 @@ CREATE TABLE `Monitor_Status` ( SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO'; SET @s = (SELECT IF( - (SELECT COUNT(*) FROM Storage WHERE Name = 'Default' AND Id=0 AND Path='/var/cache/zoneminder/events' + (SELECT COUNT(*) FROM Storage WHERE Name = 'Default' AND Id=0 AND Path='@ZM_DIR_EVENTS@' ) > 0, "SELECT 'Default Storage Area already exists.'", - "INSERT INTO Storage (Id,Name,Path,Scheme,ServerId) VALUES (0,'Default','/var/cache/zoneminder/events','Medium',NULL)" + "INSERT INTO Storage (Id,Name,Path,Scheme,ServerId) VALUES (0,'Default','@ZM_DIR_EVENTS@','Medium',NULL)" )); PREPARE stmt FROM @s;