Fixing some coding style issues.

This commit is contained in:
Daniel Baumann 2007-11-13 13:49:41 +01:00
parent 034a067667
commit e743c23cd7
1 changed files with 144 additions and 125 deletions

View File

@ -83,6 +83,7 @@ Syslinux_memtest_entry ()
KERNEL="${3}" KERNEL="${3}"
MEMTEST="${MEMTEST}\nLABEL ${LABEL}\n" MEMTEST="${MEMTEST}\nLABEL ${LABEL}\n"
# Write the menu label if the syslinux menu is being use # Write the menu label if the syslinux menu is being use
MEMTEST="${MEMTEST}\tMENU LABEL ${MENULABEL}\n" MEMTEST="${MEMTEST}\tMENU LABEL ${MENULABEL}\n"
MEMTEST="${MEMTEST}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" MEMTEST="${MEMTEST}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
@ -98,26 +99,30 @@ Syslinux_live_entry ()
INITRD="${4}" INITRD="${4}"
APPEND="${5}" APPEND="${5}"
if [ ${LH_BINARY_IMAGES} = "iso" ] || [ ${LH_BINARY_IMAGES} = "usb-hdd" ] if [ ${LH_BINARY_IMAGES} = "iso" ] || [ ${LH_BINARY_IMAGES} = "usb-hdd" ]
then then
num=$(ls -1 ${KERNEL_PATH}|grep 'vmlinuz[0-9]\+$'|wc -l) NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)"
num=$(($num +1)) NUMBER="$((${NUMBER} +1))"
# Note: ISOLINUX will not find the kernel if the name ends in ".img".
mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${num}
mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${num}.img
KERNEL=vmlinuz${num}
INITRD=initrd${num}.img
fi
# Regular kernel # 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
# Regular kernel
LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}\n" LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}\n"
# Write the menu label if the syslinux menu is being use # Write the menu label if the syslinux menu is being use
LINUX_LIVE="${LINUX_LIVE}\tMENU LABEL ${MENULABEL}\n" LINUX_LIVE="${LINUX_LIVE}\tMENU LABEL ${MENULABEL}\n"
LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND}\n" LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND}\n"
# Failsafe kernel # Failsafe kernel
LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}failsafe\n" LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}failsafe\n"
# Write the menu label if the syslinux menu is being use # Write the menu label if the syslinux menu is being use
LINUX_LIVE="${LINUX_LIVE}\tMENU LABEL ${MENULABEL} Failsafe\n" LINUX_LIVE="${LINUX_LIVE}\tMENU LABEL ${MENULABEL} Failsafe\n"
LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
@ -137,148 +142,158 @@ Syslinux_install_entry ()
APPEND="${APPEND} quiet" APPEND="${APPEND} quiet"
fi fi
for TYPE in Install Expert Rescue Auto for TYPE in Install Expert Rescue Auto
do do
case "${TYPE}" in case "${TYPE}" in
Install) Install)
TAPPEND="${APPEND}" TAPPEND="${APPEND}"
;; ;;
Expert) Expert)
TAPPEND="priority=low ${APPEND}" TAPPEND="priority=low ${APPEND}"
;; ;;
Rescue) Rescue)
TAPPEND="rescue/enable=true ${APPEND}" TAPPEND="rescue/enable=true ${APPEND}"
;; ;;
Auto) Auto)
TAPPEND="rescue/enable=true ${APPEND}" TAPPEND="rescue/enable=true ${APPEND}"
;; ;;
esac esac
LINUX_INSTALL="${LINUX_INSTALL}\nLABEL ${LABEL}${TYPE}\n" LINUX_INSTALL="${LINUX_INSTALL}\nLABEL ${LABEL}${TYPE}\n"
LINUX_INSTALL="${LINUX_INSTALL}\tMENU LABEL Start ${LABEL} ${TYPE}\n" LINUX_INSTALL="${LINUX_INSTALL}\tMENU LABEL Start ${LABEL} ${TYPE}\n"
LINUX_INSTALL="${LINUX_INSTALL}\tkernel ${LIVE_INSTALL_KERNEL_PATH}/${KERNEL}\n" LINUX_INSTALL="${LINUX_INSTALL}\tkernel ${LIVE_INSTALL_KERNEL_PATH}/${KERNEL}\n"
LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=${LIVE_INSTALL_KERNEL_PATH}/${INITRD} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\n" LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=${LIVE_INSTALL_KERNEL_PATH}/${INITRD} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\n"
done done
} }
Copy_syslinux_templates () Copy_syslinux_templates ()
{ {
cp -r "${TEMPLATES}"/common/* ${SCREEN_PATH} cp -r "${TEMPLATES}"/common/* ${SCREEN_PATH}
if [ "${LH_SYSLINUX_MENU}" = "disabled" ]
then
cp "${TEMPLATES}"/normal/*.cfg ${SCREEN_PATH}
cp "${TEMPLATES}"/normal/data/* ${DATA_PATH}
else
cp "${TEMPLATES}"/menu/*.cfg ${SCREEN_PATH}
cp "${TEMPLATES}"/menu/data/* ${DATA_PATH}
if [ "${LH_SYSLINUX_MENU}" = "disabled" ]
then
cp "${TEMPLATES}"/normal/*.cfg ${SCREEN_PATH}
cp "${TEMPLATES}"/normal/data/* ${DATA_PATH}
else
cp "${TEMPLATES}"/menu/*.cfg ${SCREEN_PATH}
cp "${TEMPLATES}"/menu/data/* ${DATA_PATH}
# Grab menu binary from chroot # Grab menu binary from chroot
MENUMODULE=$(grep 'menu.c32' ${TEMPLATES}/menu/header.cfg | sed 's,default\s*.*/\(.*menu.c32\)$,\1,g') MENUMODULE=$(grep 'menu.c32' ${TEMPLATES}/menu/header.cfg | sed 's,default\s*.*/\(.*menu.c32\)$,\1,g')
cp chroot/usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH} cp chroot/usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH}
fi fi
if [ -d "${TEMPLATES}"/"${LH_LANGUAGE}" ] if [ -d "${TEMPLATES}"/"${LH_LANGUAGE}" ]
then then
cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* ${SCREEN_PATH} cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* ${SCREEN_PATH}
else else
cp -r "${TEMPLATES}"/en/* ${SCREEN_PATH} cp -r "${TEMPLATES}"/en/* ${SCREEN_PATH}
fi fi
for FILE in ${SCREEN_PATH}/*.live for FILE in ${SCREEN_PATH}/*.live
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live)
done
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
then
for FILE in ${SCREEN_PATH}/*.install
do do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live) mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
done done
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ] if [ "${LH_ARCHITECTURE}" = "amd64" ] || [ "${LH_ARCHITECTURE}" = "i386" ] || [ "${LH_ARCHITECTURE}" = "powerpc" ]
then then
for FILE in ${SCREEN_PATH}/*.install for FILE in ${SCREEN_PATH}/*.install.g-i
do do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install) mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
done 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
else else
rm -f ${SCREEN_PATH}/*.install* rm -f ${SCREEN_PATH}/*.install.g-i
fi fi
else
rm -f ${SCREEN_PATH}/*.install*
fi
# Copying custom splash screen # Copying custom splash screen
if [ "${LH_SYSLINUX_SPLASH}" = "none" ] if [ "${LH_SYSLINUX_SPLASH}" = "none" ]
then
# no splash screen
SPLASH=""
rm -f ${SCREEN_PATH}/splash.rle
rm -f ${DATA_PATH}/splash.png
else
if [ "${LH_SYSLINUX_MENU}" = "disabled" ]
then then
# no splash screen SPLASH="${LIVE_DATA_PATH}/splash.rle"
SPLASH=""
rm -f ${SCREEN_PATH}/splash.rle
rm -f ${DATA_PATH}/splash.png
else else
if [ "${LH_SYSLINUX_MENU}" = "disabled" ] SPLASH="${LIVE_DATA_PATH}/splash.png"
then fi
SPLASH="${LIVE_DATA_PATH}/splash.rle"
else
SPLASH="${LIVE_DATA_PATH}/splash.png"
fi
if [ -n "${LH_SYSLINUX_SPLASH}" ] if [ -n "${LH_SYSLINUX_SPLASH}" ]
then
if [ ! -e "${LH_SYSLINUX_SPLASH}" ]
then then
if [ ! -e "${LH_SYSLINUX_SPLASH}" ] Echo_error "${LH_SYSLINUX_SPLASH} doen't exist"
then exit 1
Echo_error "${LH_SYSLINUX_SPLASH} doen't exist" else
exit 1 rm -f ${SCREEN_PATH}/splash.rle
else rm -f ${DATA_PATH}/splash.png
rm -f ${SCREEN_PATH}/splash.rle cp -f "${LH_SYSLINUX_SPLASH}" ${DATA_PATH}/$(basename ${SPLASH})
rm -f ${DATA_PATH}/splash.png
cp -f "${LH_SYSLINUX_SPLASH}" ${DATA_PATH}/$(basename ${SPLASH})
fi
fi fi
fi fi
fi
} }
Configure_syslinux_templates () Configure_syslinux_templates ()
{ {
templates=$(find ${SYSLINUX_PATH} -type f -name '*.cfg' -o -name '*.txt') templates="$(find ${SYSLINUX_PATH} -type f -name '*.cfg' -o -name '*.txt')"
for template_file in ${templates}; do
for template_file in ${templates}
do
sed -i -e "s@{\$LINUX_LIVE}@${LINUX_LIVE}@" \ sed -i -e "s@{\$LINUX_LIVE}@${LINUX_LIVE}@" \
-e "s@{\$LINUX_INSTALL}@${LINUX_INSTALL}@" \ -e "s@{\$LINUX_INSTALL}@${LINUX_INSTALL}@" \
-e "s@{\$MEMTEST}@${MEMTEST}@" \ -e "s@{\$MEMTEST}@${MEMTEST}@" \
-e "s@{\$LIVE_SCREEN_PATH}@${LIVE_SCREEN_PATH}@" \ -e "s@{\$LIVE_SCREEN_PATH}@${LIVE_SCREEN_PATH}@" \
-e "s@{\$LIVE_DATA_PATH}@${LIVE_DATA_PATH}@" \ -e "s@{\$LIVE_DATA_PATH}@${LIVE_DATA_PATH}@" \
-e "s@{\$LIVE_KERNEL_PATH}@${LIVE_KERNEL_PATH}@" \ -e "s@{\$LIVE_KERNEL_PATH}@${LIVE_KERNEL_PATH}@" \
-e "s@{\$SPLASH}@${SPLASH}@" \ -e "s@{\$SPLASH}@${SPLASH}@" \
-e "s/{\$LH_DISTRIBUTION}/${LH_DISTRIBUTION}/" \ -e "s/{\$LH_DISTRIBUTION}/${LH_DISTRIBUTION}/" \
-e "s/{\$LH_DATE}/$(date +%Y%m%d)/" \ -e "s/{\$LH_DATE}/$(date +%Y%m%d)/" \
-e "s/{\$LH_MEDIA}/${MEDIA}/" \ -e "s/{\$LH_MEDIA}/${MEDIA}/" \
-e "s/{\$LH_VERSION}/${VERSION}/" \ -e "s/{\$LH_VERSION}/${VERSION}/" \
-e "s/{\$LH_SYSLINUX_TIMEOUT}/${LH_SYSLINUX_TIMEOUT}0/" \ -e "s/{\$LH_SYSLINUX_TIMEOUT}/${LH_SYSLINUX_TIMEOUT}0/" \
-e 's/\ $//g' \ -e 's/\ $//g' \
$template_file $template_file
done done
# Syslinux v3.31 in etch does not support include statements # Syslinux v3.31 in etch does not support include statements
if [ "${LH_DISTRIBUTION}" = "etch" ] if [ "${LH_DISTRIBUTION}" = "etch" ]
then then
while grep -q ^include ${SCREEN_PATH}/syslinux.cfg while grep -q ^include ${SCREEN_PATH}/syslinux.cfg
do do
INCLUDES=$(grep ^include ${SCREEN_PATH}/syslinux.cfg |awk '{print $2}') INCLUDES=$(grep ^include ${SCREEN_PATH}/syslinux.cfg |awk '{print $2}')
for FILE_PATH in ${INCLUDES} for FILE_PATH in ${INCLUDES}
do do
FILE_NAME=$(basename ${FILE_PATH}) FILE_NAME=$(basename ${FILE_PATH})
sed -i -e '\@include '${FILE_PATH}'@ {
r '${SCREEN_PATH}/${FILE_NAME}' sed -i -e '\@include '${FILE_PATH}'@ {
d r '${SCREEN_PATH}/${FILE_NAME}'
d
}' ${SCREEN_PATH}/syslinux.cfg }' ${SCREEN_PATH}/syslinux.cfg
# remove the files, which were included
# remove the files, which were included
if [ -e ${SCREEN_PATH}/${FILE_NAME} ] if [ -e ${SCREEN_PATH}/${FILE_NAME} ]
then then
rm ${SCREEN_PATH}/${FILE_NAME} rm -f ${SCREEN_PATH}/${FILE_NAME}
fi fi
done done
done done
# Syslinux v3.31 in etch does not support sub directories, /path/kernel, # Syslinux v3.31 in etch does not support sub directories, /path/kernel,
# when using FAT hard drive images, remove leading /'s # when using FAT hard drive images, remove leading /'s
if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
@ -306,37 +321,38 @@ esac
case "${LH_BINARY_IMAGES}" in case "${LH_BINARY_IMAGES}" in
iso) iso)
SYSLINUX_PATH="binary/isolinux" SYSLINUX_PATH="binary/isolinux"
KERNEL_PATH="binary/${INITFS}" KERNEL_PATH="binary/${INITFS}"
SCREEN_PATH="${SYSLINUX_PATH}" SCREEN_PATH="${SYSLINUX_PATH}"
DATA_PATH="${SCREEN_PATH}/data" DATA_PATH="${SCREEN_PATH}/data"
LIVE_KERNEL_PATH="/${INITFS}" LIVE_KERNEL_PATH="/${INITFS}"
LIVE_INSTALL_KERNEL_PATH="/install" LIVE_INSTALL_KERNEL_PATH="/install"
LIVE_SCREEN_PATH="/isolinux" LIVE_SCREEN_PATH="/isolinux"
LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data" LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data"
MEDIA="CD-ROM" MEDIA="CD-ROM"
;; ;;
net) net)
SYSLINUX_PATH="tftpboot" SYSLINUX_PATH="tftpboot"
KERNEL_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}" KERNEL_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}"
SCREEN_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}/boot-screens" SCREEN_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}/boot-screens"
DATA_PATH="${SCREEN_PATH}/data" DATA_PATH="${SCREEN_PATH}/data"
LIVE_KERNEL_PATH="debian-live/${LH_ARCHITECTURE}" LIVE_KERNEL_PATH="debian-live/${LH_ARCHITECTURE}"
LIVE_INSTALL_KERNEL_PATH="debian-install/${LH_ARCHITECTURE}" LIVE_INSTALL_KERNEL_PATH="debian-install/${LH_ARCHITECTURE}"
LIVE_SCREEN_PATH="debian-live/${LH_ARCHITECTURE}/boot-screens" LIVE_SCREEN_PATH="debian-live/${LH_ARCHITECTURE}/boot-screens"
LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data" LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data"
MEDIA="netboot" MEDIA="netboot"
;; ;;
tar|usb-hdd) tar|usb-hdd)
SYSLINUX_PATH="binary/syslinux" SYSLINUX_PATH="binary/syslinux"
KERNEL_PATH="binary/${INITFS}" KERNEL_PATH="binary/${INITFS}"
SCREEN_PATH="${SYSLINUX_PATH}" SCREEN_PATH="${SYSLINUX_PATH}"
DATA_PATH="${SCREEN_PATH}/data" DATA_PATH="${SCREEN_PATH}/data"
LIVE_KERNEL_PATH="/${INITFS}" LIVE_KERNEL_PATH="/${INITFS}"
LIVE_INSTALL_KERNEL_PATH="/install" LIVE_INSTALL_KERNEL_PATH="/install"
LIVE_SCREEN_PATH="/syslinux" LIVE_SCREEN_PATH="/syslinux"
LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data" LIVE_DATA_PATH="${LIVE_SCREEN_PATH}/data"
# Syslinux v3.31 in etch does not support sub directories, /path/kernel, # Syslinux v3.31 in etch does not support sub directories, /path/kernel,
# when using FAT hard drive images # when using FAT hard drive images
if [ "${LH_DISTRIBUTION}" = "etch" ] && [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] if [ "${LH_DISTRIBUTION}" = "etch" ] && [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
@ -350,6 +366,7 @@ case "${LH_BINARY_IMAGES}" in
LIVE_SCREEN_PATH="" LIVE_SCREEN_PATH=""
LIVE_DATA_PATH="" LIVE_DATA_PATH=""
fi fi
MEDIA="hd-media" MEDIA="hd-media"
;; ;;
esac esac
@ -531,6 +548,7 @@ case "${LH_BINARY_IMAGES}" in
cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/isolinux.cfg cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/isolinux.cfg
fi fi
;; ;;
net) net)
case "${LH_CHROOT_BUILD}" in case "${LH_CHROOT_BUILD}" in
enabled) enabled)
@ -542,8 +560,8 @@ case "${LH_BINARY_IMAGES}" in
esac esac
mkdir -p ${KERNEL_PATH}/pxelinux.cfg mkdir -p ${KERNEL_PATH}/pxelinux.cfg
ln -s ${LIVE_KERNEL_PATH}/pxelinux.cfg ${SYSLINUX_PATH}/pxelinux.cfg ln -s ${LIVE_KERNEL_PATH}/pxelinux.cfg ${SYSLINUX_PATH}/pxelinux.cfg
ln -s ${LIVE_KERNEL_PATH}/pxelinux.0 ${SYSLINUX_PATH}/pxelinux.0 ln -s ${LIVE_KERNEL_PATH}/pxelinux.0 ${SYSLINUX_PATH}/pxelinux.0
mv ${SCREEN_PATH}/syslinux.cfg ${KERNEL_PATH}/pxelinux.cfg/default mv ${SCREEN_PATH}/syslinux.cfg ${KERNEL_PATH}/pxelinux.cfg/default
@ -553,6 +571,7 @@ case "${LH_BINARY_IMAGES}" in
cp "${LH_SYSLINUX_CFG}" ${KERNEL_PATH}/pxelinux.cfg/default cp "${LH_SYSLINUX_CFG}" ${KERNEL_PATH}/pxelinux.cfg/default
fi fi
;; ;;
tar|usb-hdd) tar|usb-hdd)
case "${LH_CHROOT_BUILD}" in case "${LH_CHROOT_BUILD}" in
enabled) enabled)