2009-10-28 11:15:30 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2012-08-27 13:52:29 +00:00
|
|
|
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Setting static variables
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Installs grub-pc into binary"
|
2009-10-28 11:15:30 -01:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Reading configuration files
|
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
|
|
|
Set_defaults
|
|
|
|
|
2016-01-18 02:07:48 -01:00
|
|
|
Check_Any_Bootloader_Role "grub-pc"
|
2009-10-28 11:15:30 -01:00
|
|
|
|
2015-05-04 18:33:00 +00:00
|
|
|
Echo_message "Begin installing grub-pc..."
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Requiring stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Require_stagefile .build/config .build/bootstrap
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Checking stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Check_stagefile .build/binary_grub
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Check architecture
|
2010-12-05 12:27:08 -01:00
|
|
|
Check_architectures amd64 i386
|
|
|
|
Check_crossarchitectures
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Checking depends
|
2015-01-04 16:08:09 -01:00
|
|
|
Check_package chroot /usr/bin/grub-mkimage grub-pc
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Restoring cache
|
2012-06-04 08:52:28 +00:00
|
|
|
Restore_cache cache/packages.binary
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
|
|
|
# Setting destination directory
|
2012-12-19 08:52:13 -01:00
|
|
|
case "${LIVE_IMAGE_TYPE}" in
|
2012-07-18 17:11:55 +00:00
|
|
|
hdd*|netboot)
|
2010-09-02 11:22:22 +00:00
|
|
|
Echo_warning "Bootloader in this image type not yet supported by live-build."
|
2009-10-28 11:15:30 -01:00
|
|
|
Echo_warning "This would produce a not bootable image, aborting (FIXME)."
|
|
|
|
exit 1
|
2020-02-10 14:48:49 -01:00
|
|
|
;;
|
2009-10-28 11:15:30 -01:00
|
|
|
esac
|
|
|
|
|
2010-12-05 12:27:08 -01:00
|
|
|
Check_multiarchitectures
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Copying templates
|
2015-02-07 04:56:34 -01:00
|
|
|
mkdir -p binary/boot/grub/i386-pc
|
2009-10-28 11:15:30 -01:00
|
|
|
|
2012-12-19 08:52:13 -01:00
|
|
|
case ${LIVE_IMAGE_TYPE} in
|
2010-02-18 15:34:29 -01:00
|
|
|
iso*)
|
2009-10-28 11:15:30 -01:00
|
|
|
FILES="chroot/usr/lib/grub/i386-pc/*.mod chroot/usr/lib/grub/i386-pc/*.lst chroot/usr/lib/grub/i386-pc/efiemu??.o chroot/usr/share/grub/*.pf2"
|
|
|
|
;;
|
|
|
|
|
2011-09-13 07:10:28 +00:00
|
|
|
hdd*|tar)
|
2009-10-28 11:15:30 -01:00
|
|
|
FILES="chroot/usr/lib/grub/i386-pc/*"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_BUILD_WITH_CHROOT}" = "false" ]
|
2009-10-28 11:15:30 -01:00
|
|
|
then
|
|
|
|
FILES="$(echo ${FILES} | sed -e 's|chroot||g')"
|
|
|
|
fi
|
|
|
|
|
2016-01-18 02:15:47 -01:00
|
|
|
# We rely on: binary_loopback_cfg to generate grub.cfg and other configuration files
|
|
|
|
|
2009-10-28 11:15:30 -01:00
|
|
|
# Copying grub
|
2015-02-07 04:56:34 -01:00
|
|
|
cp ${FILES} binary/boot/grub/i386-pc
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Saving cache
|
2012-06-04 08:52:28 +00:00
|
|
|
Save_cache cache/packages.binary
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
|
|
|
|
|
|
|
# Creating stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Create_stagefile .build/binary_grub
|