3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
6 ## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
13 # Including common functions
14 . "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
16 # Setting static variables
17 DESCRIPTION="$(Echo 'installs syslinux into binary')"
19 USAGE="${PROGRAM} [--force]"
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
27 if [ "${LB_BOOTLOADER}" != "syslinux" ]
32 Echo_message "Begin installing syslinux..."
34 # Requiring stage file
35 Require_stagefile .build/config .build/bootstrap
38 Check_stagefile .build/binary_syslinux
47 Check_architectures amd64 i386
48 Check_crossarchitectures
50 # Assembling image specifics
51 case "${LB_BINARY_IMAGES}" in
53 _BOOTLOADER="isolinux"
61 _TARGET="binary/isolinux"
67 _BOOTLOADER="pxelinux"
72 _BOOTLOADER="syslinux"
80 _TARGET="binary/syslinux"
87 case "${LB_BUILD_WITH_CHROOT}" in
89 Check_package chroot/usr/bin/syslinux syslinux
90 Check_package chroot/usr/lib/syslinux syslinux-common
92 if [ "${LB_SYSLINUX_THEME}" != "live-build" ]
94 Check_package chroot/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} syslinux-themes-${LB_SYSLINUX_THEME}
98 Check_package chroot/usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz gfxboot-theme-ubuntu
105 if [ ! -e /usr/bin/syslinux ]
108 Echo_error "/usr/bin/syslinux - no such file."
112 if [ ! -e /usr/lib/syslinux ]
115 Echo_error "/usr/lib/syslinux - no such directory"
119 if [ "${LB_SYSLINUX_THEME}" != "live-build" ]
121 if [ ! -e /usr/share/syslinux/themes/${LB_SYSLINUX_THEME} ]
124 Echo_error "/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} - no such directory."
132 Restore_cache cache/packages.binary
137 # FIXME: cleanup, unify, and extend themes for ${_BOOTLOADER}-live and ${_BOOTLOADER}-installer
138 if [ "${LB_SYSLINUX_THEME}" = "live-build" ]
140 if [ -e "config/bootloaders/${_BOOTLOADER}" ]
142 # Internal local copy
143 _SOURCE="config/bootloaders/${_BOOTLOADER}"
145 # Internal system copy
146 _SOURCE="${LB_BASE:-/usr/share/live/build}/bootloaders/${_BOOTLOADER}"
149 # External copy from chroot or system
150 _SOURCE="/usr/share/syslinux/themes/${LB_SYSLINUX_THEME}/${_BOOTLOADER}-live"
154 mkdir -p $(dirname ${_TARGET})
156 case "${LB_BUILD_WITH_CHROOT}" in
158 # Copy in two steps since the theme can have absolute symlinks and would therefore not be dereferenced correctly
159 if [ "${LB_SYSLINUX_THEME}" = "live-build" ]
161 cp -a ${_SOURCE} chroot/root
162 Chroot chroot cp -aL /root/$(basename ${_SOURCE}) /root/$(basename ${_SOURCE}).tmp
163 rm -rf chroot/$(basename ${_SOURCE})
165 Chroot chroot cp -aL ${_SOURCE} /root/$(basename ${_SOURCE}).tmp
170 Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp"
174 mv chroot/root/$(basename ${_SOURCE}).tmp ${_TARGET}
178 cp -aL ${_SOURCE}/* ${_TARGET}
182 tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C ${_TARGET}
189 if [ -e "${_TARGET}/live.cfg.in" ]
191 # This is all rather suboptimal.. needs prettifying at some point
192 _FLAVOURS="$(echo ${LB_LINUX_FLAVOURS} | wc -w)"
194 case "${_FLAVOURS}" in
196 mv binary/live/vmlinuz-* binary/live/vmlinuz
197 mv binary/live/initrd.img-* binary/live/initrd.img
199 sed -e "s|@FLAVOUR@|${LB_LINUX_FLAVOUR}|g" \
200 -e "s|@KERNEL@|/live/vmlinuz|g" \
201 -e "s|@INITRD@|/live/initrd.img|g" \
202 -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
203 -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
204 "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
206 rm -f "${_TARGET}/live.cfg.in"
212 for _FLAVOUR in ${LB_LINUX_FLAVOURS}
214 _NUMBER="$((${_NUMBER} + 1))"
216 mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER}
217 mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img
219 sed -e "s|@FLAVOUR@|${_FLAVOUR}|g" \
220 -e "s|@KERNEL@|/live/vmlinuz${_NUMBER}|g" \
221 -e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \
222 -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
223 -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
224 "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
227 rm -f "${_TARGET}/live.cfg.in"
230 elif [ -e "${_TARGET}/live.cfg" ]
232 sed -i -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
233 -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
237 if [ -e ${_TARGET}/install.cfg ]
239 sed -i -e "s|@LB_BOOTAPPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|g" \
240 ${_TARGET}/install.cfg
245 for _FILE in "${_TARGET}/isolinux.bin" "${_TARGET}/isolinux.cfg" "${_TARGET}/syslinux.cfg"
249 mv "${_FILE}" "${_TARGET}/$(echo ${_FILE} | sed -e 's|.*linux|boot|')"
255 case "${LB_BUILD_WITH_CHROOT}" in
258 Save_cache cache/packages.binary
265 # Creating stage file
266 Create_stagefile .build/binary_syslinux