]> git.proxmox.com Git - systemd.git/commitdiff
40-systemd: Use case instead of if statement
authorMichael Biebl <biebl@debian.org>
Sat, 1 Dec 2018 22:07:47 +0000 (23:07 +0100)
committerMichael Biebl <biebl@debian.org>
Sat, 1 Dec 2018 22:07:47 +0000 (23:07 +0100)
Makes it more readable and is also a bit faster.

Gbp-Dch: Ignore

debian/extra/init-functions.d/40-systemd

index 4e6222add17265987991eb90d8c9dc9c988b0621..4fa9b9c68f28a33fc15b0197aaee2543707c3b67 100644 (file)
@@ -92,15 +92,10 @@ if [ "$_use_systemctl" = "1" ]; then
     set +e
     set +u
 
-    if  [ "x$argument" = xstart -o \
-        "x$argument" = xstop -o \
-        "x$argument" = xrestart -o \
-        "x$argument" = xreload -o \
-        "x$argument" = xforce-reload -o \
-        "x$argument" = xtry-restart -o \
-        "x$argument" = xstatus ] ; then
-
-        systemctl_redirect $executable $argument
-        exit $?
-    fi
+    case "$argument" in
+        start|stop|restart|reload|force-reload|try-restart|status)
+            systemctl_redirect $executable $argument
+            exit $?
+            ;;
+    esac
 fi