MXS-2969: Restart MaxScale on upgrade

Renamed the postrm script to prerm since it is executed before
uninstallation.

Silenced the output of the systemctl disable commands and added a
conditional restart of MaxScale if a MaxScale instance is running.

Use getent instead of grep to detect if the maxscale user needs to be
created.
This commit is contained in:
Markus Mäkelä
2020-04-20 13:42:56 +03:00
parent c3ddcb9056
commit be567b6029
6 changed files with 17 additions and 10 deletions

View File

@ -119,7 +119,7 @@ configure_file(${CMAKE_SOURCE_DIR}/include/maxscale/paths.h.in ${CMAKE_BINARY_DI
configure_file(${CMAKE_SOURCE_DIR}/include/maxscale/adminusers.h.in ${CMAKE_BINARY_DIR}/include/maxscale/adminusers.h @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY_DIR}/include/maxscale/maxscale_test.h @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/etc/prerm.in ${CMAKE_BINARY_DIR}/prerm @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/etc/upstart/maxscale.conf.in ${CMAKE_BINARY_DIR}/upstart/maxscale.conf @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/test/maxscale_test.cnf ${CMAKE_BINARY_DIR}/maxscale.cnf @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/test/maxscale_test_secondary.cnf ${CMAKE_BINARY_DIR}/maxscale_secondary.cnf @ONLY)
@ -256,7 +256,7 @@ if(PACKAGE)
install_program(${CMAKE_BINARY_DIR}/maxscale core)
install_file(${CMAKE_BINARY_DIR}/maxscale.conf core)
install_program(${CMAKE_BINARY_DIR}/postinst core)
install_program(${CMAKE_BINARY_DIR}/postrm core)
install_program(${CMAKE_BINARY_DIR}/prerm core)
# The inclusion of CPack needs to be the last effective packaging related command. All
# configurations to packaging done after the call will be ignored.