]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
cp files to the right place
authorHolger Levsen <holger@layer-acht.org>
Thu, 8 Nov 2012 16:05:14 +0000 (17:05 +0100)
committerHolger Levsen <holger@layer-acht.org>
Thu, 8 Nov 2012 16:05:29 +0000 (17:05 +0100)
liveboot_testdeploy.sh

index bb4b5e699779d25221f8a52a8cce1d4d8df68aa8..a96e51e02ba0e361a30ffe49138828cfeb46b803 100755 (executable)
@@ -13,33 +13,44 @@ TESTSERVER_MGMT_IP=192.168.178.49
 TESTSERVER_MGMT_PASSWD_FILE=/etc/jenkins/pserver2.ipmi
 
 MAILTO=liveboot-announce@profitbricks.com
+TFTP_TARGET=/srv/tftp/liveboot
+HTTP_TARGET=/var/www/liveboot/
+
 
 #
-# check if we have a LIVEBOOT_ID
+# check if we have a LIVEBOOT_BUILD_NUMBER
 #
-if [ "$LIVEBOOT_ID" != "" ] ; then 
-       echo "Ok, got LIVEBOOT_ID=$LIVEBOOT_ID, which is valid."
+if [ "$LIVEBOOT_BUILD_NUMBER" != "" ] ; then
+       echo "Ok, got LIVEBOOT_BUILD_NUMBER=$LIVEBOOT_BUILD_NUMBER, which is valid."
 else 
-       echo "Fail, no LIVEBOOT_ID set." 
+       echo "Fail, no LIVEBOOT_BUILD_NUMBER set."
        exit 1
 fi
 #
 # check if there is an image for it
 #
-if [ -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ ] ; then
-       SOURCE_DIR=$(ls -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/)
+if [ -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_BUILD_NUMBER}/ ] ; then
+       SOURCE_DIR=$(ls -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_BUILD_NUMBER}/)
        echo "Ok, found directory $SOURCE_DIR"
 else
        figlet "Failure:"
-       echo "/srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ does not exist."
+       echo "/srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_BUILD_NUMBER}/ does not exist."
        exit 1
 fi
 
-# FIXME
 #
 # reconfigure PXE to make $TESTSERVER boot this image
 #
-#ssh liveboot@riserver echo Ok
+###
+### needs ~liveboot@riserver:.ssh/authorized_keys configured like this
+### command="/bin/cp ${SSH_ORIGINAL_COMMAND#* }",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="192.168.178.17"
+### thanks to http://larstobi.blogspot.de/2011/01/restrict-ssh-access-to-one-command-but.html
+###
+ssh liveboot@riserver cp -v $SOURCE_DIR/vmlinuz $TFTP_TARGET/
+ssh liveboot@riserver cp -v $SOURCE_DIR/initramfs.cpio.gz $TFTP_TARGET/
+echo "Ok, copied vmlinuz and initramfs.cpio.gz from $SOURCE_DIR to riserver:$TFTP_TARGET/"
+ssh liveboot@riserver cp -v $SOURCE_DIR/root.tar.xz $HTTP_TARGET/
+echo "Ok, copied root.tar.xz from $SOURCE_DIR to riserver:$HTTP_TARGET/"
 
 #
 # reboot TESTSERVER