Source

bootman / bootman.sh

Full commit
#!/bin/sh -e
#
# Bootloader configuration maintainer
#
# Requires /etc/bootman.conf and /share/bootman
#

# Setting ROOT allows one to override the default locations
SYSROOT="$ROOT"
unset ROOT
CONFIG="$SYSROOT/etc/bootman.conf"
[ -z "$DATADIR" ] && DATADIR="$SYSROOT/lib/bootman"
[ -z "$ETCDIR" ] && ETCDIR="$SYSROOT"/etc
BOOTFILES="$ETCDIR"/bootloader.conf
BOOTOPTS="$ETCDIR"/bootloader
[ -z "$BOOTDIR" ] && BOOTDIR="$SYSROOT/boot"

# Make sure /sbin is in the path
PATH="$SYSROOT/sbin:$PATH"

if [ ! -f "$CONFIG" ]; then
    echo "$0: Missing config file $CONFIG" >&2
    exit 1
fi
. "$CONFIG"

. "$DATADIR"/common.sh

if [ ! -f "$DATADIR"/"$BOOTLOADER".sh ]; then
    echo "$0: Unknown bootloader: $BOOTLOADER" >&2
    exit 1
fi

. "$DATADIR"/"$BOOTLOADER".sh
do_startup

(
    . "$BOOTFILES"
    do_postamble
) > "$CONFIG_FILE".tmp

mv -f "$CONFIG_FILE".tmp "$CONFIG_FILE"
do_finish