live-build/helpers/lh_binary_yaboot

235 lines
7.7 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:50 +00:00
#!/bin/sh
# lh_binary_yaboot(1) - installs yaboot 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.
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:50 +00:00
do
2007-09-23 08:05:11 +00:00
. "${FUNCTION}"
2007-09-23 08:04:50 +00:00
done
2007-09-23 08:05:11 +00:00
# Setting static variables
2007-09-23 08:04:50 +00:00
DESCRIPTION="installs yaboot into binary"
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
# Reading configuration files
2007-09-23 08:04:52 +00:00
Read_conffile config/common
2007-09-23 08:04:50 +00:00
Read_conffile config/bootstrap
Read_conffile config/chroot
2007-09-23 08:04:52 +00:00
Read_conffile config/binary
Read_conffile config/source
2007-09-23 08:04:50 +00:00
Set_defaults
if [ "${LIVE_BOOTLOADER}" != "yaboot" ]
then
exit 0
fi
2007-09-23 08:05:11 +00:00
Echo_message "Begin installing yaboot..."
2007-09-23 08:04:50 +00:00
# Requiring stage file
Require_stagefile .stage/bootstrap
# Checking stage file
Check_stagefile .stage/binary_yaboot
2007-09-23 08:05:13 +00:00
# Checking yaboot templates
Check_templates yaboot
2007-09-23 08:04:50 +00:00
# Checking lock file
Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
2007-09-23 08:05:13 +00:00
# Check architecture
Check_architecture powerpc ppc64
2007-09-23 08:05:09 +00:00
2007-09-23 08:04:51 +00:00
# Checking depends
Check_package chroot/usr/lib/yaboot/yaboot yaboot
2007-09-23 08:04:50 +00:00
2007-09-23 08:04:51 +00:00
# Installing depends
Install_package
2007-09-23 08:04:50 +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:09 +00:00
case "${LIVE_BINARY_IMAGES}" in
2007-09-23 08:04:50 +00:00
iso)
2007-09-23 08:05:12 +00:00
DESTDIR_LIVE="binary/live"
DESTDIR_INSTALL="binary/install"
2007-09-23 08:04:50 +00:00
;;
2007-09-23 08:05:11 +00:00
net|tar|usb-hdd)
2007-09-23 08:04:50 +00:00
Echo_error "not supported, FIXME"
;;
esac
2007-09-23 08:05:12 +00:00
# Temporary check for broken syslinux FIXME
2007-09-23 08:05:09 +00:00
if [ "${LIVE_BINARY_IMAGES}" = "iso" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:12 +00:00
# Assembling multi-arch
if [ -n "${MULTIARCH}" ]
then
case "${LIVE_ARCHITECTURE}" in
powerpc)
DESTDIR_LIVE="${DESTDIR_LIVE}.ppc"
DESTDIR_INSTALL="${DESTDIR_INSTALL}.ppc"
;;
esac
fi
2007-09-23 08:04:50 +00:00
fi
# Creating directory
2007-09-23 08:05:12 +00:00
mkdir -p "${DESTDIR_LIVE}"
2007-09-23 08:04:50 +00:00
# Setting boot parameters
if [ -n "${LIVE_ENCRYPTION}" ]
then
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} encryption=${LIVE_ENCRYPTION}"
fi
if [ -n "${LIVE_USERNAME}" ]
then
2007-09-23 08:05:09 +00:00
case "${LH_INITRAMFS}" in
casper)
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} username=${LIVE_USERNAME}"
;;
live-initramfs)
if [ "${LIVE_USERNAME}" != "user" ]
then
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} username=${LIVE_USERNAME}"
fi
;;
esac
2007-09-23 08:04:50 +00:00
fi
if [ -n "${LIVE_HOSTNAME}" ]
then
2007-09-23 08:05:11 +00:00
case "${LH_INITRAMFS}" in
2007-09-23 08:05:09 +00:00
casper)
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} hostname=${LIVE_HOSTNAME}"
;;
live-initramfs)
if [ "${LIVE_HOSTNAME}" != "debian" ]
then
2007-09-23 08:05:12 +00:00
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} hostname=${LIVE_HOSTNAME}"
2007-09-23 08:05:09 +00:00
fi
;;
esac
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:13 +00:00
if [ "${LIVE_UNION_FILESYSTEM}" != "unionfs" ]
then
LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} union=${LIVE_UNION_FILESYSTEM}"
fi
2007-09-23 08:04:50 +00:00
LIVE_BOOTAPPEND="`echo ${LIVE_BOOTAPPEND} | sed -e 's/ //'`"
2007-09-23 08:05:12 +00:00
# Parameters are listed at: linux/Documentation/kernel-parameters.txt
FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" # FIXME
2007-09-23 08:04:50 +00:00
# Assembling kernel configuration
2007-09-23 08:05:12 +00:00
if [ "${LIVE_BINARY_IMAGES}" != "net" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:09 +00:00
DEFAULT_FLAVOUR="`echo ${LIVE_LINUX_FLAVOURS} | awk '{ print $1 }'`"
2007-09-23 08:05:12 +00:00
LINUX="image=/`basename ${DESTDIR_LIVE}`/`basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR}`\n\tinitrd=/`basename ${DESTDIR_LIVE}`/initrd.img-`basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR} | sed -e 's/vmlinux-//'`\n\tlabel=live\n\tappend=\"boot=${INITFS} LIVE_BOOTAPPEND\"\n\tinitrd-size=1048576\n\tread-only"
2007-09-23 08:04:50 +00:00
else
2007-09-23 08:05:09 +00:00
DEFAULT_FLAVOUR="`echo ${LIVE_LINUX_FLAVOURS} | awk '{ print $1 }'`"
2007-09-23 08:05:12 +00:00
LINUX="image=`basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR}`\n\tinitrd=initrd.img-`basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR} | sed -e 's/vmlinux-//'`\n\tlabel=live\n\tappend=\"boot=${INITFS} LIVE_BOOTAPPEND\"\n\tinitrd-size=1048576\n\tread-only"
2007-09-23 08:04:50 +00:00
fi
# FIXME
2007-09-23 08:05:09 +00:00
if [ "`echo ${LIVE_LINUX_FLAVOURS} | wc -w`" -gt "1" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:12 +00:00
for KERNEL in chroot/boot/vmlinux*
2007-09-23 08:04:50 +00:00
do
if [ -z "${LINUX}" ]
then
2007-09-23 08:05:09 +00:00
if [ "${LIVE_BINARY_IMAGES}" = "iso" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:12 +00:00
LINUX="label LIVE-`basename ${KERNEL} | sed -e 's/vmlinux-//'`\n kernel /`basename ${DESTDIR_LIVE}`/`basename ${KERNEL}`\n append initrd=/`basename ${DESTDIR_LIVE}`/initrd.img-`basename ${KERNEL} | sed -e 's/vmlinux-//'` boot=${INITFS} LIVE_BOOTAPPEND"
2007-09-23 08:04:50 +00:00
else
2007-09-23 08:05:12 +00:00
LINUX="label LIVE-`basename ${KERNEL} | sed -e 's/vmlinux-//'`\n kernel `basename ${KERNEL}`\n append initrd=initrd.img-`basename ${KERNEL} | sed -e 's/vmlinux-//'` boot=${INITFS} LIVE_BOOTAPPEND"
2007-09-23 08:04:50 +00:00
fi
else
2007-09-23 08:05:09 +00:00
if [ "${LIVE_BINARY_IMAGES}" = "iso" ]
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:12 +00:00
LINUX="${LINUX}\nlabel LIVE-`basename ${KERNEL} | sed -e 's/vmlinux-//'`\n kernel /`basename ${DESTDIR_LIVE}`/`basename ${KERNEL}`\n append initrd=/`basename ${DESTDIR_LIVE}`/initrd.img-`basename ${KERNEL} | sed -e 's/vmlinux-//'` boot=${INITFS} LIVE_BOOTAPPEND"
2007-09-23 08:04:50 +00:00
else
2007-09-23 08:05:12 +00:00
LINUX="${LINUX}\nlabel LIVE-`basename ${KERNEL} | sed -e 's/vmlinux-//'`\n kernel `basename ${KERNEL}`\n append initrd=initrd.img-`basename ${KERNEL} | sed -e 's/vmlinux-//'` boot=${INITFS} LIVE_BOOTAPPEND"
2007-09-23 08:04:50 +00:00
fi
fi
done
fi
2007-09-23 08:05:12 +00:00
# Removing '//'
2007-09-23 08:04:50 +00:00
LINUX="`echo ${LINUX} | sed -e 's#//#/#g'`"
2007-09-23 08:05:12 +00:00
# Assembling debian-installer configuration
2007-09-23 08:05:13 +00:00
if [ "${LIVE_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:05:12 +00:00
then
VMLINUZ_DI="vmlinuz"
INITRD_DI="initrd.gz"
VMLINUZ_GI="gtk/vmlinuz"
INITRD_GI="gtk/initrd.gz"
LIVE_LINUX_INSTALL="LABEL install\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_DI}\n\tappend vga=normal initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_DI} -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL linux\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_DI}\n\tappend vga=normal initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_DI} -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL installgui\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_GI}\n\tappend video=vesa:ywrap,mtrr vga=788 initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_GI} -- "
LIVE_KENREL_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL expert\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_DI}\n\tappend priority=low vga=normal initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_DI} -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL expertgui\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_GI}\n\tappend priority=low video=vesa:ywrap,mtrr vga=788 initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_GI} -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL rescue\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_DI}\n\tappend vga=normal initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_DI} rescue/enable=true -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL rescuegui\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_GI}\n\tappend video=vesa:ywrap,mtrr vga=788 initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_GI} rescue/enable=true -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL auto\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_DI}\n\tappend auto=true priority=critical vga=normal initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_DI} -- "
LIVE_LINUX_INSTALL="${LIVE_LINUX_INSTALL}\n\nLABEL autogui\n\tkernel /`basename ${DESTDIR_INSTALL}`/${VMLINUZ_GI}\n\tappend auto=true priority=critical video=vesa:ywrap,mtrr vga=788 initrd=/`basename ${DESTDIR_INSTALL}`/${INITRD_GI} -- "
fi
LIVE_LINUX_INSTALL="`echo ${LIVE_LINUX_INSTALL} | sed -e 's/binary//g' -e 's#//#/#g'`"
2007-09-23 08:05:09 +00:00
case "${LIVE_BINARY_IMAGES}" in
2007-09-23 08:04:50 +00:00
iso)
# Copying yaboot
2007-09-23 08:05:12 +00:00
mkdir -p binary/yaboot
cp chroot/usr/lib/yaboot/yaboot binary/yaboot
2007-09-23 08:04:50 +00:00
cp -r "${LIVE_TEMPLATES}"/yaboot/* binary/yaboot
# Configure yaboot templates
2007-09-23 08:05:12 +00:00
sed -i -e "s#LIVE_LINUX_LIVE#${LINUX}#" -e "s#LIVE_LINUX_INSTALL#${LIVE_LINUX_INSTALL}#" binary/yaboot/yaboot.conf
2007-09-23 08:04:50 +00:00
sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" binary/yaboot/yaboot.conf
sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" -e "s/LIVE_VERSION/${VERSION}/" binary/yaboot/boot.msg
;;
esac
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_yaboot