#!/bin/sh # these are common variables for the auto-build scripts SYSTEM=$(uname -s | sed 'y|ABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyz|') DATE=$(date +%Y-%m-%d) TIME=$(date +%H.%M.%S) HOSTNAME=$(hostname | sed 's|\([a-zA-Z0-9-]\)\..*|\1|' | sed 'y|ABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyz|') # use the hostname from /etc/hostname in case we are a chroot build enviroment if [ -e /etc/hostname ]; then HOSTNAME=`cat /etc/hostname` else HOSTNAME=$(hostname | sed 's|\([a-zA-Z0-9-]\)\..*|\1|' | sed 'y|ABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyz|') fi ## the following creates a spam-bot that sends emails to an address that has not asked for it ## because of the spam-problem, i (jmz) have disabled it # recipient of any emails set from the scripts #RECIPIENT=pd-cvs@iem.at ## if you want to send emails about the success of your build, ## please create a file "auto-build-common.local" in this directory ## and set the "RECIPIENT" address to some valid email-address # ## please do NOT check your auto-build-common.local into the CVS # ## another possibility is to set the "RECIPIENT" environmental variable before running ## the autobuilder if [ -e ${HOME}/auto-build-common.local ]; then . ${HOME}/auto-build-common.local else echo "Could not find local configuration in \"${HOME}/auto-build-common.local\"" echo "Skipping... (see ${HOME}/auto-build-common for instructions)" echo fi # cygwin/Mingw don't have 'mail', but do have 'email' which is close enough. # To get around the troubles with mail servers, we'll contact the SMTP server # of the mailing lists directly (mail.iem.at). if [ -x /usr/bin/mail ]; then MAIL_COMMAND=/usr/bin/mail elif [ -x /bin/mail ]; then MAIL_COMMAND=/bin/mail else MAIL_COMMAND="email --smtp-server mail.iem.at" fi #------------------------------------------------------------------------------# # print out ip addresses for debugging print_ip_address() { echo -n "hostname: " hostname echo "---------------------------" if [ -x /sbin/ifconfig ]; then /sbin/ifconfig else ipconfig fi } rsync_distro() { # let rsync handle the cleanup with --delete DISTRO=$(basename $1) echo "rsyncing $DISTRO to ${1}:" RSYNC_COMMAND="rsync -a --delete-before rsync://128.238.56.50/distros/${DISTRO}/ ${1}/" case $SYSTEM in mingw*) /c/cygwin/bin/sh -c "$RSYNC_COMMAND" ;; *) $RSYNC_COMMAND ;; esac } # Mac OS X's included git or svn might be really old, so try Fink first find_git() { if [ -x /sw/bin/git ]; then echo /sw/bin/git elif [ -x /usr/bin/git ]; then echo /usr/bin/git else echo git fi } find_svn() { if [ -x /sw/bin/svn ]; then echo /sw/bin/svn elif [ -x /usr/bin/svn ]; then echo /usr/bin/svn else echo svn fi } clean_and_update_folder() { folder=$1 cd $folder if [ -d $folder/.git ]; then git=$(find_git) $git reset --hard $git clean -fdx $git pull elif [ -d $folder/.svn ]; then svn=$(find_svn) $svn revert -R . $svn status --no-ignore | \ grep -v '^X' | \ awk '{print $2}' | \ xargs rm -rf $svn update else echo "no cleaning done, unknown SCM" fi }