From eb68b75aab46df9b87b755e6b179402e98fc164f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 29 May 2018 08:54:24 +0200 Subject: [PATCH] migration scripts in specfile for upgrade and uninstall now use systemctl --- sfa.spec | 32 ++++++++++++++------------------ systemd/sfa-setup.sh | 1 + 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/sfa.spec b/sfa.spec index d15d7867..218e6ef8 100644 --- a/sfa.spec +++ b/sfa.spec @@ -191,31 +191,27 @@ rm -rf $RPM_BUILD_ROOT %files tests %{_datadir}/sfa/tests -### sfa installs the 'sfa' service +# arbitrary choice here, subject to manual tweaks if needed +# this is in line with default_config.xml +# no need to enable sfa-db, will be activated as a dependency %post -chkconfig --add sfa +systemctl enable sfa-aggregate +systemctl enable sfa-registry %preun if [ "$1" = 0 ] ; then - /sbin/service sfa stop || : - /sbin/chkconfig --del sfa || : + for service in sfa-aggregate sfa-registry sfa-db; do + systemctl is-enabled $service && systemctl disable $service + systemctl is-active $service && systemctl stop $service + done fi %postun -[ "$1" -ge "1" ] && { service sfa dbdump ; service sfa restart ; } - -#### sfa-cm installs the 'sfa-cm' service -#%post cm -#chkconfig --add sfa-cm -# -#%preun cm -#if [ "$1" = 0 ] ; then -# /sbin/service sfa-cm stop || : -# /sbin/chkconfig --del sfa-cm || : -#fi -# -#%postun cm -#[ "$1" -ge "1" ] && service sfa-cm restart || : +if [ "$1" -ge "1" ] ; then + for service in sfa-db sfa-registry sfa-aggregate; do + systemctl is-active $service && systemctl restart $service + done +fi %changelog * Mon May 28 2018 Thierry - sfa-4.0-0 diff --git a/systemd/sfa-setup.sh b/systemd/sfa-setup.sh index 7d379d6e..07698cad 100755 --- a/systemd/sfa-setup.sh +++ b/systemd/sfa-setup.sh @@ -78,6 +78,7 @@ function start-db () { export PGPORT=$SFA_DB_PORT # only if enabled + # this is because the DB can run on a separate box as well [ "$SFA_DB_ENABLED" == 1 -o "$SFA_DB_ENABLED" == True ] || return postgresql_setting port "'$SFA_DB_PORT'" -- 2.43.0