From 76c446202a681befb7424240b7122a81e9a3c232 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 7 Feb 2013 11:12:53 +0100 Subject: [PATCH] new script to setup pxe on riserver --- pxe_riserver_setup.sh | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 pxe_riserver_setup.sh diff --git a/pxe_riserver_setup.sh b/pxe_riserver_setup.sh new file mode 100755 index 0000000..7cac6ee --- /dev/null +++ b/pxe_riserver_setup.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# copyright 2013 Holger Levsen +# 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." -- 2.39.5