summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2008-06-14 17:35:11 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:35 +0100
commit243ee8a6d3cfdcfaa3aa73b7a301f5973fcb2a6a (patch)
tree738b31033c508b05a6b99cea4ea80e89f4ee3ad3 /helpers
parent85493ae3b22028a4d17a06d4b893f21cf74a959b (diff)
downloadvyos-live-build-243ee8a6d3cfdcfaa3aa73b7a301f5973fcb2a6a.tar.gz
vyos-live-build-243ee8a6d3cfdcfaa3aa73b7a301f5973fcb2a6a.zip
Replace a few unweildy "if" statements with their "case" equivalents
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/lh_binary_debian-installer34
-rwxr-xr-xhelpers/lh_binary_syslinux42
2 files changed, 41 insertions, 35 deletions
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer
index 97ed2106d..2182a2bf5 100755
--- a/helpers/lh_binary_debian-installer
+++ b/helpers/lh_binary_debian-installer
@@ -173,16 +173,17 @@ DESTDIR_GI="${DESTDIR}/gtk"
# Workaround for syslinux (<< 3.36) which doesn't support long file/path names
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
- if [ "${LH_BINARY_IMAGES}" = "tar" ] || [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
- then
- VMLINUZ_DI="vmlinuz.di"
- INITRD_DI="initrddi.gz"
- DESTDIR_DI="${DESTDIR}"
-
- VMLINUZ_GI="vmlinuz.gi"
- INITRD_GI="initrdgi.gz"
- DESTDIR_GI="${DESTDIR}"
- fi
+ case "${LH_BINARY_IMAGES}" in
+ usb-hdd|tar)
+ VMLINUZ_DI="vmlinuz.di"
+ INITRD_DI="initrddi.gz"
+ DESTDIR_DI="${DESTDIR}"
+
+ VMLINUZ_GI="vmlinuz.gi"
+ INITRD_GI="initrdgi.gz"
+ DESTDIR_GI="${DESTDIR}"
+ ;;
+ esac
fi
if [ "${LH_DEBIAN_INSTALLER_DAILY}" = "enabled" ]
@@ -252,12 +253,13 @@ wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${VMLINUZ_DI}" ${URL}/${DI_REMOTE_BASE}/${
wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${INITRD_DI}" ${URL}/${DI_REMOTE_BASE}/initrd.gz
# Downloading graphical-installer
-if [ "${LH_ARCHITECTURE}" = "amd64" ] || [ "${LH_ARCHITECTURE}" = "i386" ] || [ "${LH_ARCHITECTURE}" = "powerpc" ]
-then
- mkdir -p "${DESTDIR_GI}"
- wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${VMLINUZ_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/${DI_REMOTE_KERNEL}
- wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz
-fi
+case "${LH_ARCHITECTURE}" in
+ amd64|i386|powerpc)
+ mkdir -p "${DESTDIR_GI}"
+ wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${VMLINUZ_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/${DI_REMOTE_KERNEL}
+ wget ${WGET_OPTIONS} -O "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz
+ ;;
+esac
# Only download additional packages if appropriate
if [ "${DI_IMAGE_TYPE}" != "netboot" ]
diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux
index da3952b52..89f3fc0a9 100755
--- a/helpers/lh_binary_syslinux
+++ b/helpers/lh_binary_syslinux
@@ -94,18 +94,19 @@ Syslinux_live_entry ()
INITRD="${4}"
APPEND="${5}"
- if [ ${LH_BINARY_IMAGES} = "iso" ] || [ ${LH_BINARY_IMAGES} = "usb-hdd" ]
- then
- NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)"
- NUMBER="$((${NUMBER} +1))"
+ case "${LH_BINARY_IMAGES}" in
+ iso|usb-hdd)
+ NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)"
+ NUMBER="$((${NUMBER} +1))"
- # Note: ISOLINUX will not find the kernel if the name ends in ".img".
- mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${NUMBER}
- mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${NUMBER}.img
+ # Note: ISOLINUX will not find the kernel if the name ends in ".img".
+ mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${NUMBER}
+ mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${NUMBER}.img
- KERNEL=vmlinuz${NUMBER}
- INITRD=initrd${NUMBER}.img
- fi
+ KERNEL=vmlinuz${NUMBER}
+ INITRD=initrd${NUMBER}.img
+ ;;
+ esac
# Regular kernel
LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}\n"
@@ -209,15 +210,18 @@ Copy_syslinux_templates ()
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
done
- if [ "${LH_ARCHITECTURE}" = "amd64" ] || [ "${LH_ARCHITECTURE}" = "i386" ] || [ "${LH_ARCHITECTURE}" = "powerpc" ]
- then
- for FILE in ${SCREEN_PATH}/*.install.g-i
- do
- mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
- done
- else
- rm -f ${SCREEN_PATH}/*.install.g-i
- fi
+ case "${LH_ARCHITECTURE}" in
+ amd64|i386|powerpc)
+ for FILE in ${SCREEN_PATH}/*.install.g-i
+ do
+ mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
+ done
+ ;;
+
+ *)
+ rm -f ${SCREEN_PATH}/*.install.g-i
+ ;;
+ esac
else
rm -f ${SCREEN_PATH}/*.install*
fi