]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
new script to setup pxe on riserver
authorHolger Levsen <holger@layer-acht.org>
Thu, 7 Feb 2013 10:12:53 +0000 (11:12 +0100)
committerHolger Levsen <holger@layer-acht.org>
Thu, 7 Feb 2013 10:12:53 +0000 (11:12 +0100)
pxe_riserver_setup.sh [new file with mode: 0755]

diff --git a/pxe_riserver_setup.sh b/pxe_riserver_setup.sh
new file mode 100755 (executable)
index 0000000..7cac6ee
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# copyright 2013 Holger Levsen <holger@layer-acht.org>
+# GPL2 licenced
+
+set -x
+export
+
+if [ "$4" = "" ] || ( [ "$4" != "install" ] && [ "$4" != "sysinfo" ] && [ "$4" != "localboot" ] ) ; then 
+       echo "$0 must be called with exactly four arguments: hostname mac networkdevice action"
+       echo "eg: $0 gw1301 01-00-25-90-2c-03-8a eth1 install"
+       echo "action must be either 'install', 'sysinfo' or 'localboot'"
+       exit 1
+fi
+
+TARGET_HOST=$1
+TARGET_MAC=$2
+TARGET_DEV=$3
+TARGET_ACTION=$4
+
+TMPFILE=$(mktemp)
+cat > $TMPFILE <<-EOF
+# Generated automatically by jenkins - don't edit manually, it will be overwritten
+TIMEOUT 100
+DEFAULT $TARGET_ACTION
+
+LABEL localboot
+MENU LABEL Local boot from HDD
+MENU DEFAULT
+LOCALBOOT 0
+
+LABEL sysinfo
+MENU LABEL sysinfo
+KERNEL fai/vmlinuz-install
+APPEND initrd=fai/initrd.img root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live live-netdev=$TARGET_DEV FAI_ACTION=sysinfo FAI_FLAGS=verbose,sshd,createvt
+
+LABEL install
+MENU LABEL install
+KERNEL fai/vmlinuz-install
+APPEND initrd=fai/initrd.img root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live live-netdev=$TARGET_DEV FAI_ACTION=install FAI_FLAGS=verbose,sshd,createvt hostname=$TARGET_HOST
+EOF
+
+cat $TMPFILE
+echo
+
+echo "Copying PXE configuration for $TARGET_HOST to riserver..."
+scp $TMPFILE riserver:/srv/tftp/pxelinux.cfg/$TARGET_MAC
+rm $TMPFILE
+
+echo "Enjoy."