diff options
author | Emil Renner Berthing <esmil@labitat.dk> | 2017-11-07 16:27:49 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@labitat.dk> | 2017-11-12 14:56:32 +0100 |
commit | e8cdba85c48dcbbd42e6fcb5be3aa2912008cb84 (patch) | |
tree | 41ba5163cf6f110521f2ebc9035f77d2754796a0 /roles/space_server/files/kernel/95-syslinux-menu.install | |
download | labitat-ansible-e8cdba85c48dcbbd42e6fcb5be3aa2912008cb84.tar.gz labitat-ansible-e8cdba85c48dcbbd42e6fcb5be3aa2912008cb84.tar.xz labitat-ansible-e8cdba85c48dcbbd42e6fcb5be3aa2912008cb84.zip |
initial commit
Diffstat (limited to 'roles/space_server/files/kernel/95-syslinux-menu.install')
-rwxr-xr-x | roles/space_server/files/kernel/95-syslinux-menu.install | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/roles/space_server/files/kernel/95-syslinux-menu.install b/roles/space_server/files/kernel/95-syslinux-menu.install new file mode 100755 index 0000000..06ddad7 --- /dev/null +++ b/roles/space_server/files/kernel/95-syslinux-menu.install @@ -0,0 +1,40 @@ +#!/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 [[ -f /etc/machine-id ]]; then + read MACHINE_ID < /etc/machine-id +fi + +if ! [[ $MACHINE_ID ]]; then + exit 1 +fi + +BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION" +BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR} +MENU="$BOOT_ROOT/loader/${MACHINE_ID}.cfg" + +{ + declare -a paths + len=0 + for path in "$BOOT_ROOT/loader/entries/$MACHINE_ID"-*; do + paths[$((len++))]="$path" + done + + i=0 + while [[ $len -gt 0 ]]; do + path="${paths[$((--len))]}" + echo "LABEL $((++i))" + echo "INCLUDE ${path#$BOOT_ROOT}" + done +} > "$MENU" || { + echo "Could not create aggregated menu '$MENU'." >&2 + exit 1 +} + +exit 0 |