]> git.proxmox.com Git - mirror_corosync.git/commitdiff
Use static case blocks to determine distro flavor
authorFerenc Wágner <wferi@debian.org>
Tue, 24 Oct 2017 12:05:03 +0000 (14:05 +0200)
committerJan Friesse <jfriesse@redhat.com>
Mon, 30 Oct 2017 12:14:35 +0000 (13:14 +0100)
This is a configure-time decision, avoid live filesystem checks.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
init/corosync-notifyd.in
init/corosync-qdevice.in
init/corosync-qnetd.in
init/corosync.in

index cc944b4e9a61f8e12a74977703d50215d178b1aa..95ce4c30679be338cb019655c2ac9a1f5b455f08 100755 (executable)
@@ -49,16 +49,13 @@ status()
 
 [ -f @INITCONFIGDIR@/$prog ] && . @INITCONFIGDIR@/$prog
 
-# rpm based distros
-if [ -d @SYSCONFDIR@/sysconfig ]; then
+case '@INITCONFIGDIR@' in
+    */sysconfig) # rpm based distros
        [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
-fi
-
-# deb based distros
-if [ -d @SYSCONFDIR@/default ]; then
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
-fi
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog";;
+    */default) # deb based distros
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog";;
+esac
 
 # The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
 # This means it matches scripts, including this one.
index c69299fcc74351548245961540e962e6016b1aa8..581b6e63b5603cdf71a90f59246669a462f86e0a 100755 (executable)
@@ -49,16 +49,13 @@ status()
 
 [ -f @INITCONFIGDIR@/$prog ] && . @INITCONFIGDIR@/$prog
 
-# rpm based distros
-if [ -d @SYSCONFDIR@/sysconfig ]; then
+case '@INITCONFIGDIR@' in
+    */sysconfig) # rpm based distros
        [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
-fi
-
-# deb based distros
-if [ -d @SYSCONFDIR@/default ]; then
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
-fi
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog";;
+    */default) # deb based distros
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog";;
+esac
 
 # The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
 # This means it matches scripts, including this one.
index beee03a40713dbd0c32a450cd024a804eaa1b975..681ea085a865fd9a1a5975c33472574bbe6a0124 100755 (executable)
@@ -49,16 +49,13 @@ status()
 
 [ -f @INITCONFIGDIR@/$prog ] && . @INITCONFIGDIR@/$prog
 
-# rpm based distros
-if [ -d @SYSCONFDIR@/sysconfig ]; then
+case '@INITCONFIGDIR@' in
+    */sysconfig) # rpm based distros
        [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
-fi
-
-# deb based distros
-if [ -d @SYSCONFDIR@/default ]; then
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
-fi
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog";;
+    */default) # deb based distros
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog";;
+esac
 
 # The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
 # This means it matches scripts, including this one.
index a258c363fd79c3753de176ce056ca1765c1bc7f9..0868f1168d6b93a6968b5ae66f65da3a32b2aca3 100755 (executable)
@@ -50,16 +50,13 @@ status()
 
 [ -f @INITCONFIGDIR@/$prog ] && . @INITCONFIGDIR@/$prog
 
-# rpm based distros
-if [ -d @SYSCONFDIR@/sysconfig ]; then
+case '@INITCONFIGDIR@' in
+    */sysconfig) # rpm based distros
        [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
-fi
-
-# deb based distros
-if [ -d @SYSCONFDIR@/default ]; then
-       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
-fi
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog";;
+    */default) # deb based distros
+       [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog";;
+esac
 
 # The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
 # This means it matches scripts, including this one.