diff options
| author | sr | 2013-05-14 12:11:27 +0200 |
|---|---|---|
| committer | sr | 2013-05-14 12:11:27 +0200 |
| commit | ceeb85dda0aba7e01f400668be35a2f71e225ffb (patch) | |
| tree | a1be3447ed733d02d95432fc36287c4d5f863c86 | |
| parent | Boot menu generator (diff) | |
| download | tm-scripts-ceeb85dda0aba7e01f400668be35a2f71e225ffb.tar.gz tm-scripts-ceeb85dda0aba7e01f400668be35a2f71e225ffb.tar.xz tm-scripts-ceeb85dda0aba7e01f400668be35a2f71e225ffb.zip | |
Updat eto generate_bootmenu
| -rwxr-xr-x | generate_bootmenu.sh | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/generate_bootmenu.sh b/generate_bootmenu.sh index 7b150e0a..de3dc24e 100755 --- a/generate_bootmenu.sh +++ b/generate_bootmenu.sh @@ -6,6 +6,14 @@ # later on. # - Simon Rettberg +MLTK_PID="$$" +qnd_exit() { + unset_quiet + kill "$MLTK_PID" + [ $# -ge 1 ] && kill "$1" +} + + . "helper/logging.inc" [ $# -lt 1 ] && perror "Usage: $0 <this server's ip address>" @@ -16,7 +24,7 @@ cd "server/boot" || perror "Could not cd to server/boot" SERVERIP="$1" -ifconfig | grep "'$SERVERIP'" +ifconfig | grep -- "$SERVERIP" > /dev/null RET=$? if [ "x$RET" != "x0" ]; then pwarning "Given server IP '$SERVERIP' not found in ifconfig output. Are you sure this machine is reachable with this address?" @@ -24,9 +32,9 @@ if [ "x$RET" != "x0" ]; then fi # generate config header -LINKNAME="/srv/openslx/www/boot" -if [ -L "$LINKNAME" -o ! -e "$LINKNAME" ]; then - ln -sf "$(pwd)" "$LINKNAME" || perror "Could not link $LINKNAME to $(pwd)" +LINKLOC="/srv/openslx/www" +if [ -L "$LINKLOC/boot" -o ! -e "$LINKLOC/boot" ]; then + ln -sf -t "$LINKLOC" "$(pwd)" "boot" || perror "Could not link $LINKLOC/boot to $(pwd)" fi mkdir -p "/srv/openslx/tftp/pxelinux.cfg" || perror "Could not create directory /srv/openslx/tftp/pxelinux.cfg" CONF="/srv/openslx/tftp/pxelinux.cfg/default" @@ -91,21 +99,25 @@ BASEDIR="$(pwd)" LABEL=0 for BASE in $(ls "$BASEDIR"); do pinfo "Found base $BASE....." - for STAGE31 in $(ls "$BASEDIR/$BASE/initramfs-stage31*"); do + for STAGE31 in $(ls "$BASEDIR/$BASE/initramfs-stage31"*); do + STAGE31="$(basename "$STAGE31")" SSTAGE31="$(echo "$STAGE31" | cut -c 19-)" [ ! -z "$SSTAGE31" ] && SSTAGE31="(31-$SSTAGE31)" - pinfo "Found stage31 $SSTAGE31" - for STAGE32 in $(ls "$BASEDIR/$BASE/initramfs-stage32*"); do + pinfo " Found stage31 $SSTAGE31" + for STAGE32 in $(ls "$BASEDIR/$BASE/initramfs-stage32"*); do + STAGE32="$(basename "$STAGE32")" SSTAGE32="$(echo "$STAGE32" | cut -c 19-)" [ ! -z "$SSTAGE32" ] && SSTAGE32="(32-$SSTAGE32)" - pinfo "Found stage32 $SSTAGE32" - for KERNEL in $(ls "$BASEDIR/$BASE/kernel/vmlinuz-*"); do + pinfo " Found stage32 $SSTAGE32" + for KERNEL in $(ls "$BASEDIR/$BASE/kernel/vmlinuz-"*); do + KERNEL="$(basename "$KERNEL")" KKERNEL="$(echo "$KERNEL" | cut -c 9-)" - pinfo "Found kernel $KKERNEL" + pinfo " Found kernel $KKERNEL" LABEL=$[$LABEL + 1] # write out this combination cat >> "$CONF" << HEREEND -# --- $BASE --- $STAGE31 --- $STAGE32 --- # + +# --- $BASE --- $KERNEL --- $STAGE31 --- $STAGE32 --- # LABEL system$LABEL MENU LABEL $BASE ($KKERNEL) $SSTAGE31 $SSTAGE32 KERNEL http://$SERVERIP/boot/$BASE/kernel/$KERNEL |
