diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | add-service | 20 | ||||
-rwxr-xr-x | del-service | 11 |
4 files changed, 23 insertions, 13 deletions
@@ -1,5 +1,5 @@ PACKAGE = rpm-helper -VERSION = 0.23.6 +VERSION = 0.23.7 SVNPATH = svn+ssh://svn.mandriva.com/svn/soft/rpm/$(PACKAGE) SCRIPT_FILES = add-user del-user add-service del-service create-file \ @@ -1,3 +1,6 @@ +2011-03-07 Andrey Borzenkov <arvidjaar@gmail.com> 0.23.7 + * avoid reloading systemd twice with new chkconfig + 2011-01-25 Eugeni Dodonov <eugeni@mandriva.com 0.23.6 * Fix typo in del-service which made scriplet fail diff --git a/add-service b/add-service index c05ad5c..e7255e6 100755 --- a/add-service +++ b/add-service @@ -19,16 +19,20 @@ pkg=$1 # name of the package num=$2 # number of packages installed srv=$3 # name of the service +systemd=no +[ -x /bin/systemctl -a -r /lib/systemd/system/${srv}.service ] && systemd=yes + add_chkconfig_service() { srv=$1 - /sbin/chkconfig --add $srv - # support for systemd - if [ -x /bin/systemctl ]; then - /bin/systemctl enable ${srv}.service > /dev/null 2>&1 + # support for systemd. chkconfig will do daemon-reload for us + if [ $systemd = yes ]; then + /bin/systemctl --quiet --no-reload enable ${srv}.service fi + /sbin/chkconfig --add $srv + if [ -r /etc/sysconfig/system ]; then . /etc/sysconfig/system fi @@ -75,17 +79,17 @@ else # Upgrade mode # if the service is activated, add it again to be able to handle - # changes in start/stop levels + # changes in start/stop levels and enable systemd unit as well set -- /etc/rc3.d/S??$srv if [ $# -gt 1 ]; then echo 1>&2 "add-service: Error: $srv appears multiple times: $*" fi if [ -f "$1" ]; then - /sbin/chkconfig --add $srv - if [ -x /bin/systemctl ]; then - /bin/systemctl --enable ${srv}.service + if [ $systemd = yes ]; then + /bin/systemctl --quiet --no-reload enable ${srv}.service fi + /sbin/chkconfig --add $srv fi # restart the service if already running diff --git a/del-service b/del-service index fa38e88..096d717 100755 --- a/del-service +++ b/del-service @@ -19,14 +19,17 @@ pkg=$1 # name of the package num=$2 # number of packages installed srv=$3 # name of the service +systemd=no +[ -x /bin/systemctl -a -r /lib/systemd/system/${srv}.service ] && systemd=yes + if [ $num = 0 ]; then if [ -z "$DURING_INSTALL" ]; then /sbin/service $srv stop > /dev/null || : fi - # support for systemd - if [ -x /bin/systemctl ]; then - /bin/systemctl disable ${srv}.service > /dev/null 2>&1 - /bin/systemctl daemon-reload + + # support for systemd. chkconfig will do daemon-reload for us + if [ $systemd = yes ]; then + /bin/systemctl --quiet --no-reload disable ${srv}.service fi /sbin/chkconfig --del $srv fi |