mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-22 14:22:26 +00:00
3eb62eed1a
As part of the config gui we want to be able to have the system define new config options without them being lost if the user makes their own changes in CBFS. To allow that this change creates a function initiated in init that combines all /etc/config* files into /tmp/config. All existing scripts have been changed to source /tmp/config instead of /etc/config. The config-gui.sh script now uses /etc/config.user to hold user configuration options but the combine_configs function will allow that to expand as others want to split configuration out further. As it stands here are the current config files: /etc/config -- Compiled-in configuration options /etc/config.user -- User preferences that override /etc/config /tmp/config -- Running config referenced by the BIOS, combination of existing configs
52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Boot from signed ISO
|
|
set -e -o pipefail
|
|
. /etc/functions
|
|
. /tmp/config
|
|
|
|
MOUNTED_ISO_PATH="$1"
|
|
ISO_PATH="$2"
|
|
DEV="$3"
|
|
|
|
echo '+++ Verifying ISO'
|
|
# Verify the signature on the hashes
|
|
ISOSIG="$MOUNTED_ISO_PATH.sig"
|
|
if ! [ -r "$ISOSIG" ]; then
|
|
ISOSIG="$MOUNTED_ISO_PATH.asc"
|
|
fi
|
|
|
|
ISO_PATH="${ISO_PATH##/}"
|
|
|
|
gpgv --homedir=/etc/distro/ "$ISOSIG" "$MOUNTED_ISO_PATH" \
|
|
|| die 'ISO signature failed'
|
|
|
|
echo '+++ Mounting ISO and booting'
|
|
mount -t iso9660 -o loop $MOUNTED_ISO_PATH /boot \
|
|
|| die '$MOUNTED_ISO_PATH: Unable to mount /boot'
|
|
|
|
DEV_UUID=`blkid $DEV | tail -1 | tr " " "\n" | grep UUID | cut -d\" -f2`
|
|
ADD="fromiso=/dev/disk/by-uuid/$DEV_UUID/$ISO_PATH iso-scan/filename=/${ISO_PATH}"
|
|
REMOVE=""
|
|
|
|
paramsdir="/media/kexec_iso/$ISO_PATH"
|
|
check_config $paramsdir
|
|
|
|
ADD_FILE=/tmp/kexec/kexec_iso_add.txt
|
|
if [ -r $ADD_FILE ]; then
|
|
NEW_ADD=`cat $ADD_FILE`
|
|
ADD=$(eval "echo \"$NEW_ADD\"")
|
|
echo "+++ Overriding standard ISO kernel add arguments: $ADD"
|
|
fi
|
|
REMOVE_FILE=/tmp/kexec/kexec_iso_remove.txt
|
|
if [ -r $REMOVE_FILE ]; then
|
|
NEW_REMOVE=`cat $REMOVE_FILE`
|
|
REMOVE=$(eval "echo \"$NEW_REMOVE\"")
|
|
echo "+++ Overriding standard ISO kernel remove arguments: $REMOVE"
|
|
fi
|
|
|
|
# Call kexec and indicate that hashes have been verified
|
|
kexec-select-boot -b /boot -d /media -p "$paramsdir" \
|
|
-a "$ADD" -r "$REMOVE" -c "*.cfg" -u -i
|
|
|
|
die "Something failed in selecting boot"
|