2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2012-02-04 19:41:41 -01:00
|
|
|
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
|
|
|
## live-build 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
|
2010-09-07 13:11:20 +00:00
|
|
|
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Setting static variables
|
2009-01-15 01:37:42 -01:00
|
|
|
DESCRIPTION="$(Echo 'installs syslinux into binary')"
|
2007-09-23 08:04:48 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Reading configuration files
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-09-23 08:04:46 +00:00
|
|
|
Set_defaults
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_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
|
2008-10-14 19:32:50 +00:00
|
|
|
Require_stagefile .stage/config .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: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
|
2010-12-05 12:27:08 -01:00
|
|
|
Check_architectures amd64 i386
|
|
|
|
Check_crossarchitectures
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
# Assembling image specifics
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BINARY_IMAGES}" in
|
2010-02-18 15:34:29 -01:00
|
|
|
iso*)
|
2010-11-02 09:19:42 -01:00
|
|
|
_BOOTLOADER="isolinux"
|
2012-01-22 18:52:33 -01:00
|
|
|
_TARGET="binary/isolinux"
|
2007-09-23 08:04:50 +00:00
|
|
|
;;
|
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
net*)
|
|
|
|
_BOOTLOADER="pxelinux"
|
2012-01-22 18:52:33 -01:00
|
|
|
_TARGET="tftpboot"
|
2007-09-23 08:05:13 +00:00
|
|
|
;;
|
2007-09-23 08:04:50 +00:00
|
|
|
|
2012-01-12 10:34:53 -01:00
|
|
|
hdd*|*)
|
2010-11-02 09:19:42 -01:00
|
|
|
_BOOTLOADER="syslinux"
|
2012-01-22 18:52:33 -01:00
|
|
|
_TARGET="binary/syslinux"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Checking depends
|
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
|
|
|
true)
|
|
|
|
Check_package chroot/usr/bin/syslinux syslinux
|
|
|
|
Check_package chroot/usr/lib/syslinux syslinux-common
|
|
|
|
|
|
|
|
if [ "${LB_SYSLINUX_THEME}" != "live-build" ]
|
|
|
|
then
|
|
|
|
Check_package chroot/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} syslinux-themes-${LB_SYSLINUX_THEME}
|
|
|
|
|
|
|
|
case "${LB_MODE}" in
|
|
|
|
ubuntu)
|
|
|
|
Check_package chroot/usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz gfxboot-theme-ubuntu
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
|
|
|
if [ ! -e /usr/bin/syslinux ]
|
|
|
|
then
|
|
|
|
# syslinux
|
|
|
|
Echo_error "/usr/bin/syslinux - no such file."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e /usr/lib/syslinux ]
|
|
|
|
then
|
|
|
|
# syslinux-common
|
|
|
|
Echo_error "/usr/lib/syslinux - no such directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LB_SYSLINUX_THEME}" != "live-build" ]
|
|
|
|
then
|
2012-04-10 08:53:22 +00:00
|
|
|
if [ ! -e /usr/share/syslinux/themes/${LB_SYSLINUX_THEME} ]
|
2012-01-22 18:52:33 -01:00
|
|
|
then
|
|
|
|
# syslinux-theme
|
2012-04-10 08:53:22 +00:00
|
|
|
Echo_error "/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} - no such directory."
|
2012-01-22 18:52:33 -01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2007-09-23 08:04:50 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-01-22 18:52:33 -01:00
|
|
|
# Restoring cache
|
|
|
|
Restore_cache cache/packages_binary
|
|
|
|
|
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
|
|
|
# FIXME: cleanup, unify, and extend themes for ${_BOOTLOADER}-live and ${_BOOTLOADER}-installer
|
|
|
|
if [ "${LB_SYSLINUX_THEME}" = "live-build" ]
|
|
|
|
then
|
|
|
|
if [ -e "config/bootloaders/${_BOOTLOADER}" ]
|
|
|
|
then
|
|
|
|
# Internal local copy
|
|
|
|
_SOURCE="config/bootloaders/${_BOOTLOADER}"
|
|
|
|
else
|
|
|
|
# Internal system copy
|
|
|
|
_SOURCE="${LB_BASE:-/usr/share/live/build}/bootloaders/${_BOOTLOADER}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# External copy from chroot or system
|
|
|
|
_SOURCE="/usr/share/syslinux/themes/${LB_SYSLINUX_THEME}/${_BOOTLOADER}-live"
|
|
|
|
fi
|
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
# Copying files
|
2012-01-22 18:52:33 -01:00
|
|
|
mkdir -p $(dirname ${_TARGET})
|
2011-02-14 14:20:00 -01:00
|
|
|
|
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
|
|
|
true)
|
|
|
|
# Copy in two steps since the theme can have absolute symlinks and would therefore not be dereferenced correctly
|
2012-01-22 18:52:33 -01:00
|
|
|
if [ "${LB_SYSLINUX_THEME}" = "live-build" ]
|
|
|
|
then
|
|
|
|
cp -a ${_SOURCE} chroot/root
|
|
|
|
Chroot chroot cp -aL /root/$(basename ${_SOURCE}) /root/$(basename ${_SOURCE}).tmp
|
|
|
|
rm -rf chroot/$(basename ${_SOURCE})
|
|
|
|
else
|
|
|
|
Chroot chroot cp -aL ${_SOURCE} /root/$(basename ${_SOURCE}).tmp
|
|
|
|
fi
|
2011-09-30 10:04:33 +00:00
|
|
|
|
|
|
|
case "${LB_MODE}" in
|
|
|
|
ubuntu)
|
2012-04-17 21:52:07 +00:00
|
|
|
Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp"
|
2011-09-30 10:04:33 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-01-22 18:52:33 -01:00
|
|
|
mv chroot/root/$(basename ${_SOURCE}).tmp ${_TARGET}
|
2011-02-14 14:20:00 -01:00
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
2012-01-22 18:52:33 -01:00
|
|
|
cp -aL ${_SOURCE}/* ${_TARGET}
|
2011-09-30 10:04:33 +00:00
|
|
|
|
|
|
|
case "${LB_MODE}" in
|
|
|
|
ubuntu)
|
2012-01-22 18:52:33 -01:00
|
|
|
tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C ${_TARGET}
|
2011-09-30 10:04:33 +00:00
|
|
|
;;
|
|
|
|
esac
|
2011-02-14 14:20:00 -01:00
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
# Configuring files
|
2012-01-22 18:52:33 -01:00
|
|
|
if [ -e "${_TARGET}/live.cfg.in" ]
|
|
|
|
then
|
2012-02-06 21:02:06 -01:00
|
|
|
# This is all rather suboptimal.. needs prettifying at some point
|
|
|
|
_FLAVOURS="$(echo ${LB_LINUX_FLAVOURS} | wc -w)"
|
|
|
|
|
|
|
|
case "${_FLAVOURS}" in
|
|
|
|
1)
|
|
|
|
mv binary/live/vmlinuz-* binary/live/vmlinuz
|
|
|
|
mv binary/live/initrd.img-* binary/live/initrd.img
|
|
|
|
|
|
|
|
sed -e "s|@FLAVOUR@|${LB_LINUX_FLAVOUR}|g" \
|
|
|
|
-e "s|@KERNEL@|/live/vmlinuz|g" \
|
|
|
|
-e "s|@INITRD@|/live/initrd.img|g" \
|
|
|
|
-e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
|
|
|
|
"${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
|
|
|
|
|
|
|
|
rm -f "${_TARGET}/live.cfg.in"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
_NUMBER="0"
|
|
|
|
|
|
|
|
for _FLAVOUR in ${LB_LINUX_FLAVOURS}
|
|
|
|
do
|
|
|
|
_NUMBER="$((${_NUMBER} + 1))"
|
|
|
|
|
|
|
|
mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER}
|
|
|
|
mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img
|
|
|
|
|
|
|
|
sed -e "s|@FLAVOUR@|${_FLAVOUR}|g" \
|
|
|
|
-e "s|@KERNEL@|/live/vmlinuz${_NUMBER}|g" \
|
|
|
|
-e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \
|
|
|
|
-e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
|
|
|
|
"${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -f "${_TARGET}/live.cfg.in"
|
|
|
|
;;
|
|
|
|
esac
|
2012-01-22 18:52:33 -01:00
|
|
|
elif [ -e "${_TARGET}/live.cfg" ]
|
2007-09-23 08:04:50 +00:00
|
|
|
then
|
2010-11-02 09:19:42 -01:00
|
|
|
sed -i -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
|
2012-01-22 18:52:33 -01:00
|
|
|
${_TARGET}/live.cfg
|
2007-09-23 08:04:50 +00:00
|
|
|
fi
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2012-01-22 18:52:33 -01:00
|
|
|
if [ -e ${_TARGET}/install.cfg ]
|
2007-09-23 08:04:50 +00:00
|
|
|
then
|
2010-11-02 09:19:42 -01:00
|
|
|
sed -i -e "s|@LB_BOOTAPPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|g" \
|
2012-01-22 18:52:33 -01:00
|
|
|
${_TARGET}/install.cfg
|
2007-09-23 08:04:50 +00:00
|
|
|
fi
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
|
|
|
true)
|
|
|
|
# Saving cache
|
|
|
|
Save_cache cache/packages_binary
|
2009-11-01 12:06:46 -01:00
|
|
|
|
2010-11-02 09:19:42 -01:00
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
2007-09-23 08:04:50 +00:00
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2007-09-23 08:04:50 +00:00
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/binary_syslinux
|