Skip to content

Commit

Permalink
rpm: stop dcache service before update and disable on uninstall
Browse files Browse the repository at this point in the history
Motivation:
the rpm package should stop running dcache before updating and remove
the service from startup configuration on uninstall.

Modification:
update %pre to stop dcache on update and %preun to disable service on
uninstall.

Result:
rpm package install, update and uninstall works as expected.

Acked-by: Paul Millar
Acked-by: Lea Morschel
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Jun 30, 2020
1 parent 5fb54f3 commit 5dfef49
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions packages/fhs/src/main/rpm/dcache-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ dCache is a distributed mass storage system.
This package contains the server components.

%pre
/sbin/service dcache-server stop >/dev/null 2>&1

# stop service before upgrade
if [ $1 -eq 2 ]; then
/sbin/service dcache-server stop >/dev/null 2>&1

# as we produce multi-platform RPM don't use RPMS native mechanisms to handle
# systemd services.
# REVISIT: remove in dCache 7.0.

if [ -x /usr/bin/systemctl ]; then
/usr/bin/systemctl stop dcache.service
fi
fi


# Make sure the system user and group exist, and that
# the user is a member of the group.
Expand Down Expand Up @@ -82,13 +95,15 @@ fi
if [ $1 -eq 0 ] ; then
/sbin/service dcache-server stop >/dev/null 2>&1
/sbin/chkconfig --del dcache-server
fi

# as we produce multi-platform RPM don't use RPMS native mechanisms to handle systemd services.
# REVISIT: remove in dCache 7.0.
if [ -x /usr/bin/systemctl ]; then
/usr/bin/systemctl stop dcache.service
fi
# as we produce multi-platform RPM don't use RPMS native mechanisms to handle
# systemd services.
# REVISIT: remove in dCache 7.0.
if [ -x /usr/bin/systemctl ]; then
/usr/bin/systemctl disable --now dcache.service
/usr/bin/systemctl daemon-reload
fi
fi

%clean
rm -rf $RPM_BUILD_ROOT
Expand Down

0 comments on commit 5dfef49

Please sign in to comment.