blob: 2dd2772175e135c627a6f4cb149362cce4d338b0 (
plain) (
tree)
|
|
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
fi
if ! [[ -d "$BOOT_DIR_ABS" ]]; then
exit 0
fi
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
MENU="$BOOT_ROOT/loader/${MACHINE_ID}.cfg"
readarray -t ENTRIES < <(ls -1 -t "$BOOT_ROOT/loader/entries/$MACHINE_ID"-*)
{
i=0
for entry in "${ENTRIES[@]}"; do
echo "LABEL $((++i))"
echo "INCLUDE ${entry#$BOOT_ROOT}"
done
} > "$MENU" || {
echo "Could not create aggregated menu '$MENU'." >&2
exit 1
}
exit 0
|