Просмотр исходного кода

Use static case blocks to determine distro flavor

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>
Ferenc Wágner 8 лет назад
Родитель
Сommit
87a803ab94
4 измененных файлов с 24 добавлено и 36 удалено
  1. 6 9
      init/corosync-notifyd.in
  2. 6 9
      init/corosync-qdevice.in
  3. 6 9
      init/corosync-qnetd.in
  4. 6 9
      init/corosync.in

+ 6 - 9
init/corosync-notifyd.in

@@ -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.

+ 6 - 9
init/corosync-qdevice.in

@@ -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.

+ 6 - 9
init/corosync-qnetd.in

@@ -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.

+ 6 - 9
init/corosync.in

@@ -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.