[arch-projects] [PATCH 6/7] sysinit/shutdown: enable shopt -s nocasematch

Tom Gundersen teg at jklm.no
Sat Mar 26 18:16:34 EDT 2011


On Saturday 26 March 2011 16:32:02 Dave Reisner wrote:
> This avoids having to use =~ for checking options and allows more
> tolerance for checking user input.
> 
> Signed-off-by: Dave Reisner <d at falconindy.com>
> ---
>  rc.shutdown |    6 ++++--
>  rc.sysinit  |   10 ++++++----
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/rc.shutdown b/rc.shutdown
> index 9a04014..5fc682a 100755
> --- a/rc.shutdown
> +++ b/rc.shutdown
> @@ -6,6 +6,8 @@
>  . /etc/rc.conf
>  . /etc/rc.d/functions
> 
> +shopt -s nocasematch
> +
>  run_hook shutdown_start
> 
>  # avoid staircase effect
> @@ -61,7 +63,7 @@ stat_busy "Deactivating Swap"
>  stat_done
> 
>  # stop monitoring of lvm2 groups before unmounting filesystems
> -if [[ "$USELVM" =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
> +if [[ "$USELVM" = yes && -x /sbin/lvm && -d /sys/block ]]; then
>  	stat_busy "Deactivating monitoring of LVM2 groups"
>  	/sbin/vgchange --monitor n >/dev/null 2>&1
>  	stat_done
> @@ -86,7 +88,7 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#]
> /etc/crypttab; then stat_done
>  fi
> 
> -if [[ "$USELVM" =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
> +if [[ "$USELVM" = yes && -x /sbin/lvm && -d /sys/block ]]; then
>  	stat_busy "Deactivating LVM2 groups"
>  	/sbin/vgchange --sysinit -a n >/dev/null 2>&1
>  	stat_done
> diff --git a/rc.sysinit b/rc.sysinit
> index b08d927..bf2f83e 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -6,6 +6,8 @@
>  . /etc/rc.conf
>  . /etc/rc.d/functions
> 
> +shopt -s nocasematch
> +
>  echo " "
>  printhl "Arch Linux\n"
>  printhl "${C_H2}http://www.archlinux.org"
> @@ -113,12 +115,12 @@ run_hook sysinit_udevsettled
>      status "Bringing up loopback interface" /sbin/ifconfig lo 127.0.0.1 up
> 
>  # SoftRAID devices detection
> -if [[ $USEMDADM =~ yes|YES && -x /sbin/mdadm ]]; then
> +if [[ "$USEMDADM" = yes && -x /sbin/mdadm ]]; then
>  	status "Activating SoftRAID arrays" /sbin/mdadm --assemble --scan
>  fi
> 
>  # FakeRAID devices detection
> -if [[ $USEDMRAID =~ yes|YES && -x /sbin/dmraid ]]; then
> +if [[ "$USEDMRAID" = yes && -x /sbin/dmraid ]]; then
>  	status "Activating FakeRAID arrays" /sbin/dmraid -i -ay
>  fi
> 
> @@ -291,7 +293,7 @@ run_hook sysinit_premount
>  stat_done
> 
>  # enable monitoring of lvm2 groups, now that the filesystems are mounted rw
> -if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then +if [[
> "$USELVM" = yes && -x /sbin/lvm && -d /sys/block ]]; then
>  	stat_busy "Activating monitoring of LVM2 groups"
>  	if /sbin/vgchange --monitor y >/dev/null; then
>  		stat_done
> @@ -366,7 +368,7 @@ stat_busy "Setting Locale: $LOCALE"
>  echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
>  stat_done
> 
> -if [[ ${LOCALE,,} =~ utf ]]; then
> +if [[ $LOCALE =~ utf ]]; then
>  	stat_busy "Setting Consoles to UTF-8 mode"
>  	# UTF-8 consoles are default since 2.6.24 kernel
>  	# this code is needed not only for older kernels,

Looks fine to me.

-t


More information about the arch-projects mailing list