diff options
author | Jonathan Bauer | 2013-06-12 16:08:01 +0200 |
---|---|---|
committer | Jonathan Bauer | 2013-06-12 16:08:01 +0200 |
commit | 985d09a55a70e0bf290eb1109282fc822de15989 (patch) | |
tree | 52064bbd0f4d0bae1392638a92743106c1e25c4b /scripts | |
parent | [setup_target] started inline documentation... (diff) | |
download | tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.tar.gz tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.tar.xz tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.zip |
moved special setup scripts to scripts/
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/clone_stage4 | 33 | ||||
-rwxr-xr-x | scripts/generate_bootmenu | 131 |
2 files changed, 164 insertions, 0 deletions
diff --git a/scripts/clone_stage4 b/scripts/clone_stage4 new file mode 100755 index 00000000..f692c9e4 --- /dev/null +++ b/scripts/clone_stage4 @@ -0,0 +1,33 @@ +#!/bin/bash + +. "helper/logging.inc" + +MLTK_PID="$$" + +qnd_exit() { + unset_quiet + kill "$MLTK_PID" + [ $# -ge 1 ] && kill "$1" +} + + +[ $# -lt 3 ] && perror "$0 <vorlage> <stage> <target_dir>" + +BASEDIR="./server/local_builds/$1" +BOOTDIR="./server/boot/$1" +[ ! -d "$BASEDIR" ] && perror "Unknown Vorlage '$1'" +BASEDIR="$BASEDIR/$2" +[ ! -d "$BASEDIR" ] && perror "Unknown Stage '$2' for Vorlage '$1'" +TARGETDIR="$3" +mkdir -p "$TARGETDIR" +mkdir -p "$BOOTDIR" +[ ! -z "$(ls "$TARGETDIR")" ] && perror "Target dir '$TARGETDIR' not empty" + +pinfo "Building rsync exclude-file for building stage 4...." +cp "data/basic.nocopy" "$BOOTDIR/exclude-stage4" +find "$BASEDIR" -type f | cut -c $[${#BASEDIR} + 1]- >> "$BOOTDIR/exclude-stage4" +pinfo "Done." + +pinfo "Cloning via rsync" +rsync -a --numeric-ids -v --exclude-from="$BOOTDIR/exclude-stage4" -e "ssh -oStrictHostKeyChecking=no" "root@$1:/" "$TARGETDIR" || perror "rsync from 'root@$1:/' to '$TARGETDIR' failed." + diff --git a/scripts/generate_bootmenu b/scripts/generate_bootmenu new file mode 100755 index 00000000..de3dc24e --- /dev/null +++ b/scripts/generate_bootmenu @@ -0,0 +1,131 @@ +#!/bin/bash + +# This is a temporary script to create/update the PXE boot menu +# for OpenSLX-NG. It is designed to facilitate testing in early +# stages and will be replaced by more sophisticated scripts or tools +# 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>" + +[ ! -d "server/boot" ] && perror "Not in tm-scripts root directory or no cloned systems created." + +cd "server/boot" || perror "Could not cd to server/boot" + +SERVERIP="$1" + +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?" + sleep 2 +fi + +# generate config header +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" + +## This is the template for the boot menu +cat > "$CONF" << HEREEND +# generated by openslx-ng +# if you intend to change this file, remember that it will +# be overwritten by generate_bootmenu.sh +# this file was generated $(date) + +DEFAULT vesamenu.c32 + +# static configuration (override with include file) +NOESCAPE 0 +PROMPT 0 + +MENU BACKGROUND openslx.png +MENU WIDTH 78 +MENU MARGIN 9 +MENU PASSWORDMARGIN 9 +MENU ROWS 10 +MENU TABMSGROW 16 +MENU CMDLINEROW 16 +MENU ENDROW -1 +MENU PASSWORDROW 16 +MENU TIMEOUTROW 20 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW -1 +MENU HSHIFT 0 +MENU VSHIFT 7 + +menu color screen 37;40 #80ffffff #00000000 std +menu color border 37;40 #40000000 #ff8093a1 std +menu color title 1;37;40 #ffff8b00 #ff8093a1 std +menu color unsel 37;40 #fff0f0f0 #ff8093a1 std +menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std +menu color sel 7;37;40 #ff1c2a33 #667799bb all +menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all +menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std +menu color scrollbar 37;40 #40000000 #ee000000 std +menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std +menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std +menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std +menu color pwdborder 37;40 #40000000 #ff8093a1 std +menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std +menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std +menu color timeout_msg 37;40 #fff0f0f0 #ff8093a1 std +menu color timeout 1;37;40 #ffff8b00 #ff8093a1 std +menu color help 37;40 #ff1c2a33 #00000000 none +MENU MSGCOLOR #ff1c2a33 #00000000 none + + +# slxsettings configuration +TIMEOUT 600 +TOTALTIMEOUT 1800 +MENU TITLE OpenSLX-NG Preview + +HEREEND + +BASEDIR="$(pwd)" +LABEL=0 +for BASE in $(ls "$BASEDIR"); do + pinfo "Found base $BASE....." + 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 + 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 + KERNEL="$(basename "$KERNEL")" + KKERNEL="$(echo "$KERNEL" | cut -c 9-)" + pinfo " Found kernel $KKERNEL" + LABEL=$[$LABEL + 1] + # write out this combination + cat >> "$CONF" << HEREEND + +# --- $BASE --- $KERNEL --- $STAGE31 --- $STAGE32 --- # +LABEL system$LABEL + MENU LABEL $BASE ($KKERNEL) $SSTAGE31 $SSTAGE32 + KERNEL http://$SERVERIP/boot/$BASE/kernel/$KERNEL + INITRD http://$SERVERIP/boot/$BASE/$STAGE31,http://$SERVERIP/boot/$BASE/$STAGE32 + IPAPPEND 3 +HEREEND + done + done + done +done + |