Replacing some if conditionals with case for consistency.
authorDaniel Baumann <daniel@debian.org>
Mon, 17 Dec 2012 20:11:43 +0000 (21:11 +0100)
committerDaniel Baumann <daniel@debian.org>
Mon, 17 Dec 2012 20:11:55 +0000 (21:11 +0100)
bin/boot-init.sh
scripts/config/0030-user-setup
scripts/config/0150-xinit
scripts/config/1170-openssh-server

index fd24fb5..9dce25e 100755 (executable)
@@ -68,11 +68,12 @@ get_boot_device()
        # search in /proc/mounts for the device that is mounted at /lib/live/mount/medium
        while read DEVICE MOUNT REST
        do
-               if [ "${MOUNT}" = "/lib/live/mount/medium" ]
-               then
-                       echo "${DEVICE}"
-                       exit 0
-               fi
+               case "${MOUNT}" in
+                       /lib/live/mount/medium)
+                               echo "${DEVICE}"
+                               exit 0
+                               ;;
+               esac
        done < /proc/mounts
 }
 
@@ -106,11 +107,11 @@ Eject ()
                # "ejected" state even after reboot
                MESSAGE="Please remove the USB flash drive"
 
-               if [ "${NOPROMPT}" = "usb" ]
-               then
-                       prompt=
-               fi
-
+               case "${NOPROMPT}" in
+                       usb)
+                               prompt=
+                               ;;
+               esac
        else
                # ejecting is a very good idea here
                MESSAGE="Please remove the disc, close the tray (if any)"
@@ -120,10 +121,11 @@ Eject ()
                        eject -p -m /lib/live/mount/medium >/dev/null 2>&1
                fi
 
-               if [ "${NOPROMPT}" = "cd" ]
-               then
-                       prompt=
-               fi
+               case "${NOPROMPT}" in
+                       cd)
+                               prompt=
+                               ;;
+               esac
        fi
 
        [ "$prompt" ] || return 0
@@ -144,10 +146,12 @@ Eject ()
 echo "live-boot: caching reboot files..."
 
 prompt=1
-if [ "${NOPROMPT}" = "Yes" ]
-then
-       prompt=
-fi
+
+case "${NOPROMPT}" in
+       yes)
+               prompt=
+               ;;
+esac
 
 for path in $(which halt) $(which reboot) /etc/rc?.d /etc/default $(which stty) /bin/plymouth
 do
index d9a7f41..97a53c8 100755 (executable)
@@ -55,10 +55,11 @@ Configure_user_setup ()
        fi
 
        # Make sure user is not in sudo group if sudo is disabled
-       if [ "${_NOROOT}" = "true" ]
-       then
-               LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|sudo||')"
-       fi
+       case "${_NOROOT}" in
+               true)
+                       LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|sudo||')"
+                       ;;
+       esac
 
        # Default password is: live
        # passwords can be generated with 'echo "live" | mkpasswd -s',
index 2ab67ee..6f64532 100755 (executable)
 Xinit ()
 {
        # Checking if a display manager has been configured
-       if [ "${_X11}" = "true" ]
-       then
-               rm -f /etc/profile.d/zz-live.sh
+       case "${_X11}" in
+               true)
+                       rm -f /etc/profile.d/zz-live.sh
 
-               return
-       fi
+                       return
+                       ;;
+       esac
 
        # Checking if package is installed or already configured
        if [ ! -e /var/lib/dpkg/info/xinit.list ] || \
index 318ada1..cd3aafe 100755 (executable)
@@ -35,11 +35,12 @@ Configure_openssh_server ()
                fi
        done
 
-       if [ "${_SSH}" = "true" ]
-       then
-               # Creating state file
-               touch /var/lib/live/config/openssh-server
-       fi
+       case "${_SSH}" in
+               true)
+                       # Creating state file
+                       touch /var/lib/live/config/openssh-server
+                       ;;
+       esac
 }
 
 Openssh_server