live-build/helpers/lh_binary_syslinux

707 lines
19 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
2007-09-23 08:04:48 +00:00
# lh_binary_syslinux(1) - installs syslinux into binary
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
2007-09-23 08:04:46 +00:00
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
LH_BASE="${LH_BASE:-/usr/share/live-helper}"
for FUNCTION in "${LH_BASE}"/functions/*.sh
2007-09-23 08:04:46 +00:00
do
2007-09-23 08:05:11 +00:00
. "${FUNCTION}"
2007-09-23 08:04:46 +00:00
done
2007-09-23 08:05:11 +00:00
# Setting static variables
2007-09-23 08:04:48 +00:00
DESCRIPTION="installs syslinux into binary"
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
2007-09-23 08:04:46 +00:00
# Reading configuration files
2007-09-23 08:04:52 +00:00
Read_conffile config/common
2007-09-23 08:04:46 +00:00
Read_conffile config/bootstrap
2007-09-23 08:04:48 +00:00
Read_conffile config/chroot
2007-09-23 08:04:52 +00:00
Read_conffile config/binary
Read_conffile config/source
2007-09-23 08:05:18 +00:00
Read_conffile "${LH_CONFIG}"
2007-09-23 08:04:46 +00:00
Set_defaults
2007-09-23 08:05:17 +00:00
if [ "${LH_BOOTLOADER}" != "syslinux" ]
2007-09-23 08:04:50 +00:00
then
exit 0
fi
2007-09-23 08:05:11 +00:00
Echo_message "Begin installing syslinux..."
2007-09-23 08:04:49 +00:00
2007-09-23 08:04:46 +00:00
# Requiring stage file
2007-09-23 08:04:47 +00:00
Require_stagefile .stage/bootstrap
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Checking stage file
Check_stagefile .stage/binary_syslinux
2007-09-23 08:05:13 +00:00
# Checking syslinux templates
Check_templates syslinux
2007-09-23 08:05:13 +00:00
2007-09-23 08:04:46 +00:00
# Checking lock file
2007-09-23 08:04:47 +00:00
Check_lockfile .lock
2007-09-23 08:04:46 +00:00
# Creating lock file
2007-09-23 08:04:47 +00:00
Create_lockfile .lock
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:13 +00:00
# Check architecture
Check_architecture amd64 i386
Check_crossarchitecture
2007-09-23 08:05:09 +00:00
2007-09-23 08:04:51 +00:00
# Checking depends
Check_package chroot/usr/bin/syslinux syslinux
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:15 +00:00
# Restoring cache
Restore_cache cache/packages_binary
2007-09-23 08:04:51 +00:00
# Installing depends
Install_package
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:14 +00:00
# Local functions
Utf8_to_latin1 ()
{
VALUE="${1}"
echo "${VALUE}" | iconv -f utf-8 -t latin1
}
2007-09-19 00:43:18 +00:00
Syslinux_memtest_entry ()
{
LABEL="${1}"
MENULABEL=`Utf8_to_latin1 "${2}"`
2007-09-19 00:43:18 +00:00
KERNEL="${3}"
# syslinux << 3.36 lacks support to file/path
if [ "$(basename ${DESTDIR_LIVE})" != "binary" ]
2007-09-19 00:43:18 +00:00
then
KERNEL="${DIRECTORY}/${KERNEL}"
fi
MEMTEST="${MEMTEST}\nLABEL ${LABEL}\n"
# Write the menu label if the syslinux menu is being use
MEMTEST="${MEMTEST}\tMENU LABEL ${MENULABEL}\n"
2007-09-19 00:43:18 +00:00
MEMTEST="${MEMTEST}\tkernel /${KERNEL}\n"
MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's#//#/#g')"
2007-09-19 00:43:18 +00:00
}
2007-09-23 08:05:13 +00:00
Syslinux_live_entry ()
{
LABEL="${1}"
MENULABEL=`Utf8_to_latin1 "${2}"`
2007-09-19 00:43:18 +00:00
MENULABEL="${2}"
KERNEL="${3}"
INITRD="${4}"
APPEND="${5}"
2007-09-23 08:05:13 +00:00
2007-09-23 08:05:14 +00:00
# syslinux << 3.36 lacks support to file/path
if [ "${LH_BINARY_IMAGES}" != "net" ] && [ "$(basename ${DESTDIR_LIVE})" != "binary" ]
2007-09-23 08:05:13 +00:00
then
DIRECTORY="$(basename ${DESTDIR_LIVE})"
2007-09-23 08:05:13 +00:00
KERNEL="${DIRECTORY}/${KERNEL}"
INITRD="${DIRECTORY}/${INITRD}"
fi
LINUX_LIVE="${LINUX_LIVE}\nLABEL ${LABEL}\n"
2007-09-19 00:43:18 +00:00
# Write the menu label if the syslinux menu is being use
LINUX_LIVE="${LINUX_LIVE}\tMENU LABEL ${MENULABEL}\n"
2007-09-19 00:43:18 +00:00
2007-09-23 08:05:14 +00:00
LINUX_LIVE="${LINUX_LIVE}\tkernel /${KERNEL}\n"
LINUX_LIVE="${LINUX_LIVE}\tappend initrd=/${INITRD} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}\n"
2007-09-23 08:05:13 +00:00
}
Syslinux_install_entry ()
{
LABEL="${1}"
KERNEL="${2}"
INITRD="${3}"
APPEND="${4}"
2007-09-23 08:05:14 +00:00
# syslinux << 3.36 lacks support to file/path
if [ "${LH_BINARY_IMAGES}" != "net" ] && [ "$(basename ${DESTDIR_INSTALL})" != "binary" ]
2007-09-23 08:05:13 +00:00
then
DIRECTORY="$(basename ${DESTDIR_INSTALL})"
2007-09-23 08:05:13 +00:00
KERNEL="${DIRECTORY}/${KERNEL}"
INITRD="${DIRECTORY}/${INITRD}"
fi
2007-09-23 08:05:14 +00:00
# Boot in quiet mode
2007-09-23 08:05:17 +00:00
if [ "${LH_DISTRIBUTION}" != "etch" ] && [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ]
2007-09-23 08:05:14 +00:00
then
APPEND="${APPEND} quiet"
fi
2007-09-23 08:05:13 +00:00
LINUX_INSTALL="${LINUX_INSTALL}\nLABEL ${LABEL}\n"
2007-09-23 08:05:14 +00:00
LINUX_INSTALL="${LINUX_INSTALL}\tkernel /${KERNEL}\n"
2007-09-23 12:05:12 +00:00
LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=/${INITRD} ${APPEND} LH_BOOTAPPEND_INSTALL\n"
2007-09-23 08:05:13 +00:00
}
2007-09-23 08:04:52 +00:00
case "${LH_INITRAMFS}" in
casper)
INITFS="casper"
;;
live-initramfs)
INITFS="live"
;;
esac
2007-09-23 08:04:50 +00:00
# Setting destination directory
2007-09-23 08:05:17 +00:00
case "${LH_BINARY_IMAGES}" in
2007-09-23 08:04:50 +00:00
iso)
2007-09-23 08:05:13 +00:00
case "${LH_INITRAMFS}" in
casper)
DESTDIR_LIVE="binary/casper"
;;
live-initramfs)
DESTDIR_LIVE="binary/live"
;;
esac
2007-09-23 08:04:52 +00:00
DESTDIR_INSTALL="binary/install"
2007-09-23 08:04:50 +00:00
;;
net)
2007-09-23 08:04:52 +00:00
DESTDIR_LIVE="tftpboot"
DESTDIR_INSTALL="tftpboot"
2007-09-23 08:05:13 +00:00
;;
2007-09-23 08:04:50 +00:00
2007-09-23 08:05:11 +00:00
tar|usb-hdd)
2007-09-23 08:05:13 +00:00
case "${LH_INITRAMFS}" in
casper)
DESTDIR_LIVE="binary/casper"
;;
live-initramfs)
DESTDIR_LIVE="binary/live"
;;
esac
2007-09-23 08:05:12 +00:00
DESTDIR_INSTALL="binary/install"
2007-09-23 08:05:14 +00:00
# syslinux << 3.36 lacks support for long file/path
2007-09-23 08:05:17 +00:00
if [ "${LH_DISTRIBUTION}" = "etch" ]
2007-09-23 08:05:09 +00:00
then
DESTDIR_LIVE="binary"
DESTDIR_INSTALL="binary"
fi
2007-09-23 08:04:50 +00:00
;;
esac
2007-09-23 08:05:14 +00:00
Check_multiarchitecture
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:50 +00:00
# Creating directory
2007-09-23 08:05:11 +00:00
mkdir -p "${DESTDIR_LIVE}"
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:50 +00:00
# Setting boot parameters
2007-09-23 08:05:17 +00:00
if [ -n "${LH_ENCRYPTION}" ]
2007-09-23 08:04:50 +00:00
then
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}"
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:17 +00:00
if [ -n "${LH_USERNAME}" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:09 +00:00
case "${LH_INITRAMFS}" in
casper)
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}"
2007-09-23 08:05:09 +00:00
;;
live-initramfs)
2007-09-23 08:05:17 +00:00
if [ "${LH_USERNAME}" != "user" ]
2007-09-23 08:05:09 +00:00
then
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}"
2007-09-23 08:05:09 +00:00
fi
;;
esac
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:17 +00:00
if [ -n "${LH_HOSTNAME}" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:11 +00:00
case "${LH_INITRAMFS}" in
2007-09-23 08:05:09 +00:00
casper)
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}"
2007-09-23 08:05:09 +00:00
;;
live-initramfs)
2007-09-23 08:05:17 +00:00
if [ "${LH_HOSTNAME}" != "debian" ]
2007-09-23 08:05:09 +00:00
then
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}"
2007-09-23 08:05:09 +00:00
fi
;;
esac
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:17 +00:00
if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ]
2007-09-23 08:05:13 +00:00
then
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}"
2007-09-23 08:05:13 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ "${LH_BINARY_IMAGES}" = "net" ]
2007-09-23 08:05:14 +00:00
then
2007-09-23 08:05:17 +00:00
case "${LH_NET_FILESYSTEM}" in
2007-09-23 08:05:14 +00:00
nfs)
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=nfs nfsroot=LH_NET_SERVER:LH_NET_PATH"
2007-09-23 08:05:14 +00:00
;;
cifs)
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//LH_NET_SERVERLH_NET_PATH"
2007-09-23 08:05:14 +00:00
;;
*)
Echo_error "Unsupported net filesystem"
exit 1
;;
esac
2007-09-23 08:05:17 +00:00
if [ -n "${LH_NET_MOUNTOPTIONS}" ]
2007-09-23 08:05:14 +00:00
then
LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfsopts=${LH_NET_MOUNTOPTIONS}"
2007-09-23 08:05:14 +00:00
fi
fi
LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's/ //')"
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:50 +00:00
# Parameters are listed at: linux/Documentation/kernel-parameters.txt
FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal"
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:50 +00:00
# Assembling kernel configuration
2007-09-23 08:05:09 +00:00
2007-09-23 08:05:13 +00:00
# Default entries
DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')"
DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})"
DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's/vmlinuz-//')"
2007-09-23 08:05:13 +00:00
Syslinux_live_entry "live" "${LH_SYSLINUX_MENU_LIVE_ENTRY}" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}"
2007-09-19 00:43:18 +00:00
Syslinux_live_entry "live-failsafe" "${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${FAILSAFE}"
2007-09-23 08:04:50 +00:00
if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:14 +00:00
for KERNEL in chroot/boot/vmlinuz-*
2007-09-23 08:04:50 +00:00
do
KERNEL_IMAGE="$(basename ${KERNEL})"
KERNEL_VERSION="$(echo ${KERNEL_IMAGE} | sed -e 's/vmlinuz-//')"
2007-09-23 08:05:13 +00:00
INITRD="initrd.img-${KERNEL_VERSION}"
2007-09-19 00:43:18 +00:00
Syslinux_live_entry "live-${KERNEL_VERSION}" "${LH_SYSLINUX_MENU_LIVE_ENTRY}" "${KERNEL_IMAGE}" "${INITRD}"
Syslinux_live_entry "live-${KERNEL_VERSION}-failsafe" "${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}" "${KERNEL_IMAGE}" "${INITRD}" "${FAILSAFE}"
2007-09-23 08:04:50 +00:00
done
fi
2007-09-23 08:04:48 +00:00
LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's/binary//g' -e 's#//#/#g')"
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:52 +00:00
# Assembling debian-installer configuration
2007-09-23 08:05:17 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:04:52 +00:00
then
2007-09-23 08:05:12 +00:00
VMLINUZ_DI="vmlinuz"
INITRD_DI="initrd.gz"
2007-09-23 08:05:13 +00:00
APPEND_DI="vga=normal"
2007-09-23 08:05:12 +00:00
VMLINUZ_GI="gtk/vmlinuz"
INITRD_GI="gtk/initrd.gz"
2007-09-23 08:05:13 +00:00
APPEND_GI="video=vesa:ywrap,mtrr vga=788"
2007-09-23 08:05:12 +00:00
2007-09-23 08:05:09 +00:00
# Workaround for syslinux (<< 3.36) which doesn't support long file/path names
2007-09-23 08:05:17 +00:00
if [ "${LH_DISTRIBUTION}" = "etch" ]
2007-09-23 08:05:09 +00:00
then
2007-09-23 08:05:17 +00:00
if [ "${LH_BINARY_IMAGES}" = "tar" ] || [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
2007-09-23 08:05:09 +00:00
then
VMLINUZ_DI="vmlinuz.di"
INITRD_DI="initrddi.gz"
VMLINUZ_GI="vmlinuz.gi"
INITRD_GI="initrdgi.gz"
fi
fi
2007-09-23 08:05:13 +00:00
Syslinux_install_entry "linux" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
Syslinux_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
Syslinux_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
Syslinux_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
Syslinux_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}"
Syslinux_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
Syslinux_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}"
2007-09-23 08:05:14 +00:00
Syslinux_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
Syslinux_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}"
2007-09-23 08:04:52 +00:00
fi
LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's/binary//g' -e 's#//#/#g')"
2007-09-23 08:05:09 +00:00
2007-09-23 08:04:50 +00:00
# Assembling memtest configuration
2007-09-23 08:04:52 +00:00
if [ -f "${DESTDIR_LIVE}"/memtest ]
2007-09-23 08:04:50 +00:00
then
2007-09-19 00:43:18 +00:00
Syslinux_memtest_entry "memtest" "${LH_SYSLINUX_MENU_MEMTEST_ENTRY}" "memtest"
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:17 +00:00
case "${LH_BINARY_IMAGES}" in
2007-09-23 08:04:50 +00:00
iso)
# Copying syslinux
mkdir -p binary/isolinux
2007-09-23 08:05:15 +00:00
2007-09-23 08:05:17 +00:00
case "${LH_CHROOT_BUILD}" in
2007-09-23 08:05:15 +00:00
enabled)
cp chroot/usr/lib/syslinux/isolinux.bin binary/isolinux
;;
disabled)
cp /usr/lib/syslinux/isolinux.bin binary/isolinux
;;
esac
# Syslinux templates
cp -r "${TEMPLATES}"/common/* binary/isolinux
if [ "${LH_SYSLINUX_MENU}" = "disabled" ]
then
cp -r "${TEMPLATES}"/normal/* binary/isolinux
else
cp -r "${TEMPLATES}"/menu/* binary/isolinux
fi
if [ -d "${TEMPLATES}"/"${LH_LANGUAGE}" ]
then
cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* binary/isolinux
else
cp -r "${TEMPLATES}"/en/* binary/isolinux
fi
2007-09-23 08:05:16 +00:00
for FILE in binary/isolinux/*.live
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live)
2007-09-23 08:05:16 +00:00
done
2007-09-23 08:05:17 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:05:16 +00:00
then
for FILE in binary/isolinux/*.install
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
2007-09-23 08:05:16 +00:00
done
case "${LH_ARCHITECTURE}" in
amd64|i386|powerpc)
for FILE in binary/isolinux/*.install.g-i
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
done
;;
*)
rm -f binary/isolinux/*.install.g-i
;;
esac
2007-09-23 08:05:16 +00:00
else
rm -f binary/isolinux/*.install*
fi
2007-09-23 08:05:14 +00:00
mv binary/isolinux/syslinux.cfg binary/isolinux/isolinux.cfg
2007-09-19 00:43:18 +00:00
# Copying configuration file
if [ -n "${LH_SYSLINUX_CFG}" ]
then
cp "${LH_SYSLINUX_CFG}" binary/isolinux/isolinux.cfg
fi
2007-09-23 08:05:14 +00:00
# Copying local configuration file
if [ -f config/binary_syslinux/syslinux.cfg ]
then
2007-09-19 00:43:18 +00:00
LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"
2007-09-23 08:05:14 +00:00
fi
2007-09-23 08:04:46 +00:00
2007-09-19 00:43:18 +00:00
# Copying menu module
if [ "${LH_SYSLINUX_MENU}" != "disabled" ]
2007-09-23 08:04:51 +00:00
then
MENUPATH="$(grep 'menu.c32' binary/isolinux/header.cfg | sed 's,default\s*\(.*menu.c32\)$,\1,g')"
MENUMODULE="$(basename ${MENUPATH})"
2007-09-19 00:43:18 +00:00
mkdir -p binary/isolinux/"$(dirname ${MENUPATH})"
cp chroot/usr/lib/syslinux/"${MENUMODULE}" binary/isolinux/"$(dirname ${MENUPATH})"
2007-09-23 08:04:51 +00:00
fi
2007-09-19 00:43:18 +00:00
# Copying splash screen
if [ -z "${LH_SYSLINUX_SPLASH}" ] || [ "${LH_SYSLINUX_SPLASH}" = "none" ]
2007-09-23 08:04:50 +00:00
then
2007-09-19 00:43:18 +00:00
rm -f binary/isolinux/splash.rle
sed -i -e "s/.*splash.*//" binary/isolinux/boot.txt
else
if [ "${LH_SYSLINUX_MENU}" != "disabled" ]
2007-09-23 08:04:46 +00:00
then
SPLASHPATH="$(grep -i 'menu background' binary/isolinux/header.cfg | sed 's,menu\sbackground\s*\(.*\)$,\1,g')"
2007-09-19 00:43:18 +00:00
if [ ! -e "${LH_SYSLINUX_SPLASH}" ]
then
Echo_error "${LH_SYSLINUX_SPLASH} doen't exist"
exit 1
fi
mkdir -p binary/isolinux/"$(dirname ${SPLASHPATH})"
2007-09-19 00:43:18 +00:00
cp -f "${LH_SYSLINUX_SPLASH}" binary/isolinux/"${SPLASHPATH}"
2007-09-23 08:04:50 +00:00
else
2007-09-23 08:05:17 +00:00
cp -f "${LH_SYSLINUX_SPLASH}" binary/isolinux/splash.rle
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Configure syslinux templates
sed -i -e "s@LINUX_LIVE@${LINUX_LIVE}@" -e "s@LINUX_INSTALL@${LINUX_INSTALL}@" -e "s@MEMTEST@${MEMTEST}@" binary/isolinux/menu.cfg
sed -i -e "s#LH_BOOTAPPEND_INSTALL#${LH_BOOTAPPEND_INSTALL}#" -e "s#LH_BOOTAPPEND_LIVE#${LH_BOOTAPPEND_LIVE}#" binary/isolinux/menu.cfg
2007-09-19 00:43:18 +00:00
if [ -e binary/isolinux/f1.txt ]
then
sed -i -e "s/LH_DISTRIBUTION/${LH_DISTRIBUTION}/" -e "s/LH_DATE/$(date +%Y%m%d)/" -e "s/LH_MEDIA/CD-ROM/" binary/isolinux/f1.txt
2007-09-19 00:43:18 +00:00
fi
2007-09-23 08:05:17 +00:00
sed -i -e "s/LH_MEDIA/CD-ROM/" binary/isolinux/f3.txt
2007-09-19 00:43:18 +00:00
if [ -e binary/isolinux/f10.txt ]
then
sed -i -e "s/LH_VERSION/${VERSION}/" binary/isolinux/f10.txt
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Working arround syslinux 8.3 limitation
if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:13 +00:00
NUMBER="0"
# FIXME: This has a bug *iff* flavours = 686 686-bigmem (note the order).
2007-09-23 08:05:17 +00:00
for FLAVOUR in ${LH_LINUX_FLAVOURS}
2007-09-23 08:04:50 +00:00
do
2007-09-23 08:05:13 +00:00
NUMBER="$(($NUMBER + 1))"
2007-09-23 08:04:50 +00:00
2007-09-23 08:04:52 +00:00
mv "${DESTDIR_LIVE}"/vmlinuz-*-${FLAVOUR} "${DESTDIR_LIVE}"/vmlinuz${NUMBER}
mv "${DESTDIR_LIVE}"/initrd.img-*-${FLAVOUR} "${DESTDIR_LIVE}"/initrd${NUMBER}.img
sed -i -e "s/vmlinuz-.*-${FLAVOUR}$/vmlinuz${NUMBER}/g" -e "s/initrd.img-.*-${FLAVOUR} /initrd${NUMBER}.img /g" binary/isolinux/menu.cfg
2007-09-23 08:04:50 +00:00
done
else
2007-09-23 08:05:17 +00:00
mv "${DESTDIR_LIVE}"/vmlinuz-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/vmlinuz
mv "${DESTDIR_LIVE}"/initrd.img-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/initrd.img
sed -i -e "s/vmlinuz-.*-${LH_LINUX_FLAVOURS}/vmlinuz/g" -e "s/initrd.img-.*-${LH_LINUX_FLAVOURS}/initrd.img/g" binary/isolinux/menu.cfg
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:13 +00:00
sed -i -e "s/LINUX_TIMEOUT/${LH_SYSLINUX_TIMEOUT}/" binary/isolinux/footer.cfg
2007-09-23 08:05:17 +00:00
2007-09-23 08:05:13 +00:00
# Remove whitespaces
sed -i -e 's/\ $//g' binary/isolinux/*.cfg
2007-09-23 08:04:50 +00:00
;;
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
net)
# Copying syslinux
2007-09-23 08:05:15 +00:00
mkdir -p tftpboot
2007-09-23 08:05:17 +00:00
case "${LH_CHROOT_BUILD}" in
2007-09-23 08:05:15 +00:00
enabled)
cp chroot/usr/lib/syslinux/pxelinux.0 tftpboot
;;
disabled)
cp /usr/lib/syslinux/pxelinux.0 tftpboot
;;
esac
2007-09-23 08:04:50 +00:00
mkdir -p tftpboot/pxelinux.cfg
cp -r "${TEMPLATES}"/common/* tftpboot/pxelinux.cfg
cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* tftpboot/pxelinux.cfg
2007-09-23 08:05:16 +00:00
for FILE in tftpboot/pxelinux.cfg/*.live
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live)
2007-09-23 08:05:16 +00:00
done
2007-09-23 08:05:17 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:05:16 +00:00
then
for FILE in tftpboot/pxelinux.cfg/*.install
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
2007-09-23 08:05:16 +00:00
done
2007-09-23 08:05:17 +00:00
if [ "${LH_ARCHITECTURE}" = "amd64" ] || [ "${LH_ARCHITECTURE}" = "i386" ] || [ "${LH_ARCHITECTURE}" = "powerpc" ]
2007-09-23 08:05:16 +00:00
then
for FILE in tftpboot/pxelinux.cfg/*.install.g-i
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
2007-09-23 08:05:16 +00:00
done
else
rm -f tftpboot/pxelinux.cfg/*.install.g-i
fi
else
rm -f tftpboot/pxelinux.cfg/*.install*
fi
2007-09-23 08:05:14 +00:00
mv tftpboot/pxelinux.cfg/syslinux.cfg tftpboot/pxelinux.cfg/default
# Copying local configuration file
if [ -f config/binary_syslinux/syslinux.cfg ]
then
cp config/binary_syslinux/syslinux.cfg tftpboot/pxelinux.cfg/default
fi
#sed -i -e 's#splash.rle#pxelinux.cfg/splash.rle#' tftpboot/pxelinux.cfg/boot.txt
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Copying splash screen
2007-09-23 08:04:51 +00:00
if [ -f config/binary_syslinux/splash.rle ]
then
2007-09-23 08:05:17 +00:00
LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -n "${LH_SYSLINUX_SPLASH}" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:17 +00:00
if [ "${LH_SYSLINUX_SPLASH}" = "none" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:50 +00:00
rm -f tftpboot/pxelinux.cfg/splash.rle
2007-09-23 12:05:12 +00:00
sed -i -e "s/.*splash.*//" tftpboot/pxelinux.cfg/boot.txt
2007-09-23 08:04:50 +00:00
else
2007-09-23 08:05:17 +00:00
cp -f "${LH_SYSLINUX_SPLASH}" tftpboot/pxelinux.cfg/splash.rle
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Configure syslinux templates
2007-09-23 08:05:13 +00:00
sed -i -e "s@LINUX_LIVE@${LINUX_LIVE}@" -e "s@LINUX_INSTALL@${LINUX_INSTALL}@" -e "s@MEMTEST@${MEMTEST}@" tftpboot/pxelinux.cfg/default
2007-09-23 12:05:12 +00:00
sed -i -e "s#LH_BOOTAPPEND_INSTALL#${LH_BOOTAPPEND_INSTALL}#" -e "s#LH_BOOTAPPEND_LIVE#${LH_BOOTAPPEND_LIVE}#" -e "s/LH_NET_SERVER/${LH_NET_SERVER}/" -e "s#LH_NET_PATH#${LH_NET_PATH}#" tftpboot/pxelinux.cfg/default
sed -i -e "s/LH_DISTRIBUTION/${LH_DISTRIBUTION}/" -e "s/LH_DATE/$(date +%Y%m%d)/" -e "s/LH_MEDIA/netboot/" tftpboot/pxelinux.cfg/f1.txt
2007-09-23 08:05:17 +00:00
sed -i -e "s/LH_MEDIA/netboot/" tftpboot/pxelinux.cfg/f3.txt
sed -i -e "s/LH_VERSION/${VERSION}/" tftpboot/pxelinux.cfg/f10.txt
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Working arround syslinux 8.3 limitation
if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -eq "1" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:17 +00:00
mv "${DESTDIR_LIVE}"/vmlinuz-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/vmlinuz
mv "${DESTDIR_LIVE}"/initrd.img-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/initrd.img
sed -i -e "s/vmlinuz-.*-${LH_LINUX_FLAVOURS}/vmlinuz/g" -e "s/initrd.img-.*-${LH_LINUX_FLAVOURS}/initrd.img/g" tftpboot/pxelinux.cfg/default
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:13 +00:00
2007-09-23 08:05:17 +00:00
sed -i -e "s/LINUX_TIMEOUT/${LH_SYSLINUX_TIMEOUT}/" tftpboot/pxelinux.cfg/default
2007-09-23 08:05:13 +00:00
# Remove whitespaces
2007-09-23 08:05:14 +00:00
sed -i -e 's/\ $//g' tftpboot/pxelinux.cfg/default
2007-09-23 08:04:50 +00:00
;;
2007-09-23 08:05:11 +00:00
tar|usb-hdd)
2007-09-23 08:05:09 +00:00
# Workaround for syslinux (<< 3.36) which doesn't support dedicated directory
2007-09-23 08:05:17 +00:00
if [ "${LH_DISTRIBUTION}" = "etch" ]
2007-09-23 08:05:09 +00:00
then
DESTDIR="binary"
else
DESTDIR="binary/syslinux"
fi
2007-09-23 08:04:50 +00:00
# Copying syslinux
2007-09-23 08:05:09 +00:00
mkdir -p "${DESTDIR}"
2007-09-23 08:05:15 +00:00
2007-09-23 08:05:17 +00:00
case "${LH_CHROOT_BUILD}" in
2007-09-23 08:05:15 +00:00
enabled)
cp chroot/usr/lib/syslinux/isolinux.bin "${DESTDIR}"/syslinux.bin
;;
disabled)
cp /usr/lib/syslinux/isolinux.bin "${DESTDIR}"/syslinux.bin
;;
esac
cp -r "${TEMPLATES}"/common/* "${DESTDIR}"
2007-10-09 16:04:56 +00:00
if [ "${LH_SYSLINUX_MENU}" = "disabled" ]
then
cp -r "${TEMPLATES}"/normal/* "${DESTDIR}"
else
cp -r "${TEMPLATES}"/menu/* "${DESTDIR}"
fi
cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* "${DESTDIR}"
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:16 +00:00
for FILE in "${DESTDIR}"/*.live
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live)
2007-09-23 08:05:16 +00:00
done
2007-09-23 08:05:17 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:05:16 +00:00
then
for FILE in "${DESTDIR}"/*.install
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
2007-09-23 08:05:16 +00:00
done
2007-09-23 08:05:17 +00:00
if [ "${LH_ARCHITECTURE}" = "amd64" ] || [ "${LH_ARCHITECTURE}" = "i386" ] || [ "${LH_ARCHITECTURE}" = "powerpc" ]
2007-09-23 08:05:16 +00:00
then
for FILE in "${DESTDIR}"/*.install.g-i
do
mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
2007-09-23 08:05:16 +00:00
done
else
rm -f "${DESTDIR}"/*.install.g-i
fi
else
rm -f "${DESTDIR}"/*.install*
fi
2007-09-23 08:05:14 +00:00
# Copying local configuration file
if [ -f config/binary_syslinux/syslinux.cfg ]
then
cp config/binary_syslinux/syslinux.cfg "${DESTDIR}"/syslinux.cfg
fi
2007-09-23 08:04:50 +00:00
# Copying splash screen
2007-09-23 08:04:51 +00:00
if [ -f config/binary_syslinux/splash.rle ]
then
2007-09-23 08:05:17 +00:00
LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -n "${LH_SYSLINUX_SPLASH}" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:17 +00:00
if [ "${LH_SYSLINUX_SPLASH}" = "none" ]
2007-09-23 08:04:48 +00:00
then
2007-09-23 08:05:09 +00:00
rm -f "${DESTDIR}"/splash.rle
2007-09-23 12:05:12 +00:00
sed -i -e "s/.*splash.*//" "${DESTDIR}"/boot.txt
2007-09-23 08:04:48 +00:00
else
2007-09-23 08:05:17 +00:00
cp -f "${LH_SYSLINUX_SPLASH}" "${DESTDIR}"/splash.rle
2007-09-23 08:04:48 +00:00
fi
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Configure syslinux templates
sed -i -e "s@LINUX_LIVE@${LINUX_LIVE}@" -e "s@LINUX_INSTALL@${LINUX_INSTALL}@" -e "s@MEMTEST@${MEMTEST}@" "${DESTDIR}"/menu.cfg
sed -i -e "s#LH_BOOTAPPEND_INSTALL#${LH_BOOTAPPEND_INSTALL}#" -e "s#LH_BOOTAPPEND_LIVE#${LH_BOOTAPPEND_LIVE}#" "${DESTDIR}"/menu.cfg
if [ -e binary/isolinux/f1.txt ]
then
sed -i -e "s/LH_DISTRIBUTION/${LH_DISTRIBUTION}/" -e "s/LH_DATE/$(date +%Y%m%d)/" -e "s/LH_MEDIA/hd-media/" "${DESTDIR}"/f1.txt
fi
sed -i -e "s/LH_MEDIA/hd-media/" "${DESTDIR}"/f3.txt
if [ -e binary/isolinux/f10.txt ]
then
sed -i -e "s/LH_VERSION/${VERSION}/" "${DESTDIR}"/f10.txt
fi
2007-09-23 08:05:09 +00:00
# Workaround for syslinux (<< 3.36) which doesn't support long file/path names
if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:13 +00:00
NUMBER="0"
2007-09-23 08:05:17 +00:00
for FLAVOUR in ${LH_LINUX_FLAVOURS}
2007-09-23 08:05:12 +00:00
do
2007-09-23 08:05:13 +00:00
NUMBER="$(($NUMBER + 1))"
2007-09-23 08:05:12 +00:00
mv "${DESTDIR_LIVE}"/vmlinuz-*-${FLAVOUR} "${DESTDIR_LIVE}"/vmlinuz${NUMBER}
mv "${DESTDIR_LIVE}"/initrd.img-*-${FLAVOUR} "${DESTDIR_LIVE}"/initrd${NUMBER}.img
sed -i -e "s/vmlinuz-.*-${FLAVOUR}$/vmlinuz${NUMBER}/g" -e "s/initrd.img-.*-${FLAVOUR} /initrd${NUMBER}.img /g" "${DESTDIR}"/menu.cfg
2007-09-23 08:05:12 +00:00
done
else
2007-09-23 08:05:17 +00:00
mv "${DESTDIR_LIVE}"/vmlinuz-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/vmlinuz
mv "${DESTDIR_LIVE}"/initrd.img-*-${LH_LINUX_FLAVOURS} "${DESTDIR_LIVE}"/initrd.img
sed -i -e "s/vmlinuz-.*-${LH_LINUX_FLAVOURS}/vmlinuz/g" -e "s/initrd.img-.*-${LH_LINUX_FLAVOURS}/initrd.img/g" "${DESTDIR}"/menu.cfg
sed -i -e "s/LINUX_TIMEOUT/${LH_SYSLINUX_TIMEOUT}/" "${DESTDIR}"/footer.cfg
2007-09-23 08:04:50 +00:00
fi
# Remove whitespaces
sed -i -e 's/\ $//g' "${DESTDIR}"/*.cfg
2007-09-23 08:04:50 +00:00
;;
esac
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:15 +00:00
# Saving cache
Save_cache cache/packages_binary
2007-09-23 08:04:51 +00:00
# Removing depends
Remove_package
2007-09-23 08:04:50 +00:00
# Creating stage file
Create_stagefile .stage/binary_syslinux