Commits

M0E-lnx  committed aecb126

Finishing deploy script and fixing upload script to avoid timeout

  • Participants
  • Parent commits bf19ea0

Comments (0)

Files changed (2)

File deploy_slave.sh

 
 CHROOTS_HOME=${1:-"/usr/src/vlbuildbot/JAILS"}
 SLAVES_HOME=${2:-"/home/vlbuildbot/slaves"}
+SLAVE_NAME=${3:-"vlbuildbot-slave"}
+SLAVE_PASS=${4:-"vlbuildbot-pass"}
 ## slavehost.conf will default to /etc/vlbuildbot/slavehost.conf
 declare -A ISO
 
 ## Checkout the latest vlbuildbot to /tmp
 CWD=$(pwd)
+
+function warn {
+	clear
+	echo "--------------------------------------------------------------"
+	echo "VECTORLINUX BUILDSLAVE CREATION PROCESS"
+	echo ""
+	echo "This his process will setup a vlbuildbot slave instance."
+	echo "WARNING:  We are about to download the necessary ISO images to"
+	echo "create the required chroot jails.  This requires an internet"
+	echo "connection and may take a while.  For every jail created, "
+	echo "YOU WILL BE PROMPTED TO SETUP THE TIMEZONE AND KEYBOARD MAP."
+	echo "After the slave is setup, you just need to enable it for "
+	echo "runlevel 3"
+	echo ""
+	printf "Are you sure you want to continue? [y|n]: " 
+	read cont
+	if [ "$cont" != "y" ]; then
+		exit 0
+	fi
+}
+
+function make_chroots {
 git pull
 
 ## Bring in the slavehost.conf to the local dir
 sed -i "s|^SLAVES_ROOT=.*|$slavesdef|g" $conf
 sed -i "s|^JAILS=.*|$chrootsdef|g" $conf
 
-# We will download the ISO's first
 # Currently VECTOR 7.0 and 7.1 32 and 64-bit
 VLVERSIONS="32c7p0 64c7p0 32c7p1 64c7p1"
 
 mkdir -p $CHROOTS_HOME
 
 ## Download the ISOS
-cd $CHROTS_HOME
+cd $CHROOTS_HOME
 ## mkdir -p vectorlinux-7.{0,1} # ??
 
 
 echo " + Downloading ISO images"
 for rel in $VLVERSIONS; do
     link=$(echo ${ISO[$rel]})
+    if [ "x$link" != "x" ]; then
     echo "Downloading ${link}"
     vldotrel=$(echo $rel | cut -f 2 -d c|sed 's/p/./'g)
     isoarch=$(echo $rel | cut -f 1 -d c)
     let fieldn=$(($fieldn+1))
     isoname=$(echo $link|cut -f $fieldn -d "/")
     jailname=$(basename $isoname .iso)
+    echo "iso name: $isoname"
+    echo "jail name: $jailname"
+    exit 0
 
     ## Update the conf to match the path to the jail
     chrootdef="CHROOTS[$rel]=\"$PWD/$jailname\""
 	exit 1
     fi
     ## create the jail dir
-    mkdir $jailname
-    cd $jailname
+    mkdir -p $CHROOTS_HOME/$jailname
+    cd $CHROOTS_HOME/$jailname
     wget -c --no-check-certificate $link
     ## make the chroot
     $CWD/slave/sbin/mkchrootSB $isoname $chrootarch $vldotrel
     ## Customize the chroot
     mkdir CHROOT-RO/home/slackbuilds
     cp /etc/resolv.conf CHROOT-RO/etc/resolv.conf
-    mv CHROOT-RO/usr/bin/requiredbuilder $CHROOT-RO/usr/bin/requiredbuilder.real
+    mv CHROOT-RO/usr/bin/requiredbuilder CHROOT-RO/usr/bin/requiredbuilder.real
     cp $CWD/slave/chroot/usr/bin/requiredbuilder CHROOT-RO/usr/bin/
     if [ "$chrootarch" == "i586" ]; then
 	# replace the uname binary
 
     ## handle the slapt-getrc changes
     cat $CWD/slapt-getrc.$rel > CHROOT-RO/etc/slapt-get/slapt-getrc
-    
+    fi
     
 done
+}
 
+function install_host_config {
 ## Copy the slavehost.conf file to the right location
 mkdir -p /etc/vlbuildslave/
 mv $PWD/slavehost.conf /etc/vlbuildslave/slavehost.conf
-    
-
+}
+
+function install_slave {
+    echo "Installing slave instance"
+    easy_install buildbot-slave
+    # We need to revert the twisted version ?
+    easy_install http://twistedmatrix.com/Releases/Twisted/12.1/Twisted-12.1.0.tar.bz2
+    cd $SLAVES_HOME
+    # Creating vlbuildbot slave
+    buildslave create-slave --umask=022 $SLAVE_NAME vlcore.vectorlinux.com:60024 $SLAVE_NAME $SLAVE_PASS
+    (
+    	cd $CWD/slave
+	cd etc
+	cp -ar rc.d /etc/ -var
+	cd ..
+	cp sbin / -var
+	cp usr / -var
+	)
+}
+
+function show_help {
+    echo "Usage:"
+    echo "$0 [ chroots_home ] [ slaves_home ]"
+    echo "chroots_home is the directory where the chroot jails will be installed.  Defaults to /usr/src/vlbuildbot/JAILS"
+    echo "slaves_home is the directory where the slave instance will be installed.  Defaults to $SLAVES_HOME"
+    echo ""
+    exit 0
+}
+
+function setup_wizard {
+    warn
+    make_chroots
+    install_host_config
+    install_slave
+}
+
+case $1 in
+    "-h")
+	show_help
+	exit 0
+	;;
+    "--help")
+	show_help
+	exit 0
+	;;
+esac
+
+setup_wizard

File slave/usr/local/bin/build-pusher

 # Source the settings defined in /tmp/buildbot/vectorlinux/slave.conf
 #source /tmp/buildbot/vectorlinux/slave.conf
 source /etc/vlbuildslave/slavehost.conf || exit 1
+LOCKFILE=/tmp/vlbuildbot-upload.lock
+
+trap "rm -rf $LOCKFILE; exit" INT TERM EXIT
 
 BUILDER=$1
 
 	esac
 
 echo " + Processing ${pkg}"
+echo $$ > $LOCKFILE
 lftp <<EOF
 open sftp://$URL -u build-catcher,fakepass
 cd pool/veclinux-${VLVER}/${pooldir}
 echo " - Removing any previous ${name}-${version} builds at remote pool"
-glob rm -r ${rmtarget}-*
-mput ${name}-${version}-*
-bye
+queue glob rm -r ${rmtarget}-*
+queue mput ${name}-${version}-*
+queue !rm $LOCKFILE
+queue bye
 EOF
+
+while [ -f $LOCKFILE ]; do
+	printf "#"
+	sleep 5
+done
+printf "\nDone\n"
 done
 }
 
 	echo "PWD: $PWD"
 	# upload source directory with SB and tarball (only if necessary)
 	echo "Uploading source directory for ${appname} to source repository"
-    lftp <<EOF
+    	echo $$ > $LOCKFILE
+	lftp <<EOF
 	open sftp://$URL -u build-catcher,fakepass
 	cd src/veclinux-${VLVER}
-	glob rm -r ${appname}
-	mkdir ${appname}
-	cd ${appname}
-	mirror -R -c --no-perms --no-umask .
-	bye
+	queue glob rm -r ${appname}
+	queue mkdir ${appname}
+	queue cd ${appname}
+	queue mirror -R -c --no-perms --no-umask .
+	queue !rm $LOCKFILE
+	queue bye
 EOF
+while [ -f $LOCKFILE ]; do
+	printf "#"
+	sleep 5
+done
+printf "\nDone\n"
+
 }
 
 process_uploads(){