#!/bin/bash # # openmamba-autobuild-autoport daily cron script # (c) 2008-2012 by Silvan Calarco # #. /etc/sysconfig/openmamba-central . /etc/sysconfig/autoport [ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0 ME=`basename $0` [ "$$" == "`pidof -x $ME`" ] || { [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting." exit 0 } PIDFILE=/var/run/autodist/autodist.pid HOUR=`date +%H` [ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1 function pid_check() { [ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE` [ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && { echo "Error: an autodist process is already running; exiting for safety." exit 0 } } pid_check for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do [ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then CMD_PREFIX=linux32 else CMD_PREFIX= fi for r in ${AUTOPORT_REPOSITORIES[$i]}; do echo "Autoport start at `date`" > /var/autodist/log/autoport-$r.log echo "========================" >> /var/autodist/log/autoport-$r.log done if [ "${AUTOPORT_CHROOT[$i]}" ]; then a=${AUTOPORT_CHROOT[$i]} # sudo mount -o bind /proc /var/autoport/$a/proc [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment" echo "Updating packages in $a chroot environment..." >> /var/autodist/log/autoport-chroot-$a.log LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> /var/autodist/log/autoport-chroot-$a.log for r in ${AUTOPORT_REPOSITORIES[$i]}; do echo "Working on $r($a) in chroot mode..." >> /var/autodist/log/autoport-$r.log [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" > $local_ftp/$r/autoport-$a.log $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $local_ftp/$r/autoport-$a.log cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/log >> $local_ftp/$r/autoport-$a.log echo >> $local_ftp/$r/autoport-$a.log done fi if [ "${AUTOPORT_NATIVE[$i]}" ]; then a=${AUTOPORT_ARCH[$i]} [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment" echo "Updating packages in $a native environment..." >> /var/autodist/log/autoport-native-$a.log LANG=C smart update > /dev/null LANG=C smart upgrade -y >> /var/log/autoupgrade for r in ${AUTOPORT_REPOSITORIES[$i]}; do echo "Working on $r($a) in native mode" >> /var/autodist/log/autoport-$r.log su -l autodist -c "autoport -b -r $r" >> /var/autodist/log/autoport-$r.log cat /var/autodist/.autoport/$a/log >> /var/autodist/log/autoport-$r.log echo >> /var/autodist/log/autoport-$r.log done fi if [ "${AUTOPORT_CROSS[$i]}" ]; then a=${AUTOPORT_CROSS[$i]} for r in ${AUTOPORT_REPOSITORIES[$i]}; do [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode" echo "Working on $r($a) in cross-platform mode" >> /var/autodist/log/autoport-$r.log su -l autodist -c "autoport -b -x $a -r $r" > $local_ftp/$r/autoport-$a.log cat /var/autodist/.autoport/$a/log >> $local_ftp/$r/autoport-$a.log echo >> $local_ftp/$r/autoport-$a.log done fi for r in ${AUTOPORT_REPOSITORIES[$i]}; do [ -e /var/autodist/log/autoport-$r.log ] && \ cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log done done