diff options
-rwxr-xr-x | add-service | 64 | ||||
-rwxr-xr-x | del-service | 22 |
2 files changed, 43 insertions, 43 deletions
diff --git a/add-service b/add-service index dbd2816..09e549d 100755 --- a/add-service +++ b/add-service @@ -7,7 +7,7 @@ # Authors : Frederic Lepied, Andrey Borzenkov # Created On : Mon Jul 8 08:14:34 2002 # Purpose : helper script for rpm scriptlets to add a -# service. +# service. #--------------------------------------------------------------- if [ x$1 = x--no-sysv ]; then @@ -36,33 +36,33 @@ units_to_enable= # units enabled by msec add_chkconfig_service() { if [ -n "$units_to_enable" ]; then - /bin/systemctl --quiet enable $units_to_enable + /bin/systemctl --quiet enable $units_to_enable fi if [ -n "$srv" ]; then - /sbin/chkconfig --add $srv + /sbin/chkconfig --add $srv else - exit 0 + exit 0 fi if [ -r /etc/sysconfig/system ]; then - . /etc/sysconfig/system + . /etc/sysconfig/system fi # TODO what to do with system units here? if [ -z "$ADD_SERVICES_TO_CURRENT_PROFILE_ONLY" ]; then - # add the service to all the profiles at once - if [ -d /etc/netprofile/profiles/default/services ]; then - for dir in /etc/netprofile/profiles/*/services; do - touch $dir/$srv - done - fi + # add the service to all the profiles at once + if [ -d /etc/netprofile/profiles/default/services ]; then + for dir in /etc/netprofile/profiles/*/services; do + touch $dir/$srv + done + fi fi } add_service() { # Add the service if [ -r /etc/sysconfig/msec ]; then - . /etc/sysconfig/msec + . /etc/sysconfig/msec fi # High security: add only authorized services @@ -71,7 +71,7 @@ add_service() { # during the install the symlink isn't done so find the right file # by ourselves if [ -n "$DURING_INSTALL" -a ! -f $LIST ]; then - LIST=/etc/security/msec/server.$SECURE_LEVEL + LIST=/etc/security/msec/server.$SECURE_LEVEL fi # This is half-hearted support for msec: we check "srv" for a unit @@ -81,20 +81,20 @@ add_service() { # not need to be checked. # TODO should msec support full unit name? if [ -f $LIST ]; then - if [ -n "$srv" ]; then - if fgrep -qx "${srv}" $LIST; then - units_to_enable="$units" - else - srv= - fi - else - for i in $units; do - [ $i != ${i%.service} ] && ! fgrep -qx ${i%.service} $LIST && continue - units_to_enable="$units_to_enable $i" - done - fi + if [ -n "$srv" ]; then + if fgrep -qx "${srv}" $LIST; then + units_to_enable="$units" + else + srv= + fi + else + for i in $units; do + [ $i != ${i%.service} ] && ! fgrep -qx ${i%.service} $LIST && continue + units_to_enable="$units_to_enable $i" + done + fi else - units_to_enable="$units" + units_to_enable="$units" fi add_chkconfig_service @@ -118,18 +118,18 @@ else set -- /etc/rc3.d/S??$srv if [ $# -gt 1 ]; then - echo 1>&2 "add-service: Error: $srv appears multiple times: $*" + echo 1>&2 "add-service: Error: $srv appears multiple times: $*" fi if [ -f "$1" ]; then - /sbin/chkconfig --add $srv + /sbin/chkconfig --add $srv fi if [ -z "$units" ] || ! /bin/mountpoint -q /sys/fs/cgroup/systemd; then - # restart the service if already running - if [ -f /var/lock/subsys/$srv ]; then - /sbin/service $srv restart > /dev/null || : - fi + # restart the service if already running + if [ -f /var/lock/subsys/$srv ]; then + /sbin/service $srv restart > /dev/null || : + fi fi fi diff --git a/del-service b/del-service index 47b66a7..c19b1f2 100755 --- a/del-service +++ b/del-service @@ -7,7 +7,7 @@ # Authors : Frederic Lepied, Andrey Borzenkov # Created On : Tue Jul 9 08:11:26 2002 # Purpose : helper script for rpm scriptlets to remove a -# service. +# service. #--------------------------------------------------------------- if [ x$1 = x--no-sysv ]; then @@ -38,13 +38,13 @@ units_to_remove= if [ $num = 0 ]; then if [ -z "$DURING_INSTALL" ]; then - if [ -n "$units" ]; then - if /bin/mountpoint -q /sys/fs/cgroup/systemd; then - /bin/systemctl stop $units - fi - elif [ -n "srv" ]; then - /sbin/service $srv stop > /dev/null || : - fi + if [ -n "$units" ]; then + if /bin/mountpoint -q /sys/fs/cgroup/systemd; then + /bin/systemctl stop $units + fi + elif [ -n "srv" ]; then + /sbin/service $srv stop > /dev/null || : + fi fi [ -n "$units" ] && /bin/systemctl --no-reload --quiet disable $units @@ -55,9 +55,9 @@ if [ $num = 0 ]; then # reload again. Systemd units are supposed to provide postun script if [ -n "$srv" -a -z "$units" ] && \ - /bin/mountpoint -q /sys/fs/cgroup/systemd; then - /bin/rm -f /etc/rc.d/init.d/$srv - /bin/systemctl daemon-reload + /bin/mountpoint -q /sys/fs/cgroup/systemd; then + /bin/rm -f /etc/rc.d/init.d/$srv + /bin/systemctl daemon-reload fi fi |