[arch-projects] [INITSCRIPTS][PATCH 4/6] Use bash case modification to check yes/no

Sébastien Luttringer seblu at seblu.net
Mon Jun 11 17:10:38 EDT 2012


Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
---
 rc.shutdown |    6 +++---
 rc.sysinit  |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/rc.shutdown b/rc.shutdown
index c708b92..faa250c 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -27,7 +27,7 @@ status 'Saving Random Seed' /usr/lib/systemd/systemd-random-seed save
 halt -w
 
 # stop monitoring of lvm2 groups before unmounting filesystems
-[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) ]] &&
+[[ ${USELVM,,} == yes && -x $(type -P lvm) ]] &&
 	status "Deactivating monitoring of LVM2 groups" vgchange --monitor n
 
 # any future uevents can and should be ignored
@@ -58,7 +58,7 @@ if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
 	stat_busy "Deactivating encrypted volumes:"
 		# Maybe someone has LVM on an encrypted block device
 		# executing an extra vgchange is errorless
-		[[ $USELVM = [Yy][Ee][Ss] ]] && vgchange --sysinit -a n &>/dev/null
+		[[ ${USELVM,,} == yes ]] && vgchange --sysinit -a n &>/dev/null
 		do_lock() {
 			stat_append "${1}.."
 			if cryptsetup remove "$1" &>/dev/null; then
@@ -71,7 +71,7 @@ if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
 	stat_done
 fi
 
-[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) ]] &&
+[[ ${USELVM,,} = yes && -x $(type -P lvm) ]] &&
 	status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null
 
 run_hook shutdown_poweroff
diff --git a/rc.sysinit b/rc.sysinit
index c276da7..12339b6 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -86,11 +86,11 @@ status 'Configuring Virtual Consoles' /usr/lib/systemd/systemd-vconsole-setup
 	status "Bringing up loopback interface" ip link set up dev lo
 
 # FakeRAID devices detection
-[[ $USEDMRAID = [Yy][Ee][Ss] && -x $(type -P dmraid) ]] &&
+[[ ${USEDMRAID,,} == yes && -x $(type -P dmraid) ]] &&
 	status "Activating FakeRAID arrays" dmraid -i -ay
 
 # BTRFS devices detection
-[[ $USEBTRFS = [Yy][Ee][Ss] && -x $(type -P btrfs) ]] &&
+[[ ${USEBTRFS,,} == yes && -x $(type -P btrfs) ]] &&
 	status "Activating BTRFS volumes" btrfs device scan
 
 # Activate LVM2 groups if any
@@ -130,7 +130,7 @@ status "Mounting Local Filesystems" \
 run_hook sysinit_postmount
 
 # enable monitoring of lvm2 groups, now that the filesystems are mounted rw
-[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
+[[ ${USELVM,,} == yes && -x $(type -P lvm) && -d /sys/block ]] &&
 	status "Activating monitoring of LVM2 groups" \
 		vgchange --monitor y >/dev/null
 
-- 
Sebastien "Seblu" Luttringer



More information about the arch-projects mailing list