From: Holger Levsen Date: Wed, 20 Feb 2013 17:30:16 +0000 (+0100) Subject: initial scripts to install cr13 and gw1301 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=a497cb323e93e6f40ba76755aaac0b0d224ac7db;p=profitbricks%2Fjenkins-build-scripts.git initial scripts to install cr13 and gw1301 --- diff --git a/pxe_install.sh b/pxe_install.sh new file mode 100755 index 0000000..1ddb789 --- /dev/null +++ b/pxe_install.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# copyright 2013 Holger Levsen +# GPL2 licenced + +set -x +export +echo + +if [ "$3" = "" ] ; then + echo "$0 must be called with exactly three arguments: hostname mac networkdevice" + echo "eg: $0 gw1301 01-00-25-90-2c-03-8a eth1" + exit 1 +fi + +TARGET_HOST=$1 +TARGET_MAC=$2 +TARGET_DEV=$3 +TMPOUTPUT=$(mktemp) + +$(dirname $0)/pxe_riserver_setup.sh $TARGET_HOST $TARGET_MAC $TARGET_DEV install ; \ +ipmitool -H ${TARGET_HOST}-ipmi -f /etc/jenkins/$TARGET_HOST.ipmi -U ADMIN chassis power reset ; \ +sleep 90 ; \ +$(dirname $0)/pxe_riserver_setup.sh $TARGET_HOST $TARGET_MAC $TARGET_DEV localboot + +#ipmitool -H ${TARGET_HOST}-ipmi -f /etc/jenkins/$TARGET_HOST.ipmi -U ADMIN -I lanplus sol activate < /dev/zero | tee $TMPOUTPUT & + +set +x +# +# check for 15min whether ssh comes back +# +echo "Checking for sshd running on $TARGET_HOST..." +for i in $(seq 1 90) ; do + sleep 10 + if $(ping -c 1 $TARGET_HOST >/dev/null) ; then + echo -n "ping $TARGET_HOST ok..." + # check ssh + if $(nc -z $TARGET_HOST 22 ) ; then + echo "ok, sshd is running at $(date +%H:%M:%S)" + break + else + echo "but sshd is not running at $(date +%H:%M:%S)" + fi + fi +done +if ! $(nc -z $TARGET_HOST 22 ) ; then + figlet "Failure:" + echo "$TARGET_HOST still not running sshd, please investigate." + exit 1 +fi +echo + +rm $TMPOUTPUT + diff --git a/pxe_riserver_setup.sh b/pxe_riserver_setup.sh index ddcc596..f810148 100755 --- a/pxe_riserver_setup.sh +++ b/pxe_riserver_setup.sh @@ -42,12 +42,12 @@ 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,reboot console=tty0 console=ttyS1,115200 +APPEND initrd=fai/initrd.img root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live live-netdev=$TARGET_DEV FAI_ACTION=sysinfo FAI_FLAGS=verbose,createvt,reboot console=tty0 console=ttyS1,115200 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,reboot console=tty0 console=ttyS1,115200 hostname=$TARGET_HOST +APPEND initrd=fai/initrd.img root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live live-netdev=$TARGET_DEV FAI_ACTION=install FAI_FLAGS=verbose,createvt,reboot console=tty0 console=ttyS1,115200 hostname=$TARGET_HOST EOF cat $TMPFILE