autodist/etc/cron.hourly/65-openmamba-autobuild-autoport

77 lines
3.0 KiB
Plaintext
Raw Normal View History

2011-05-04 02:31:45 +02:00
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
2011-05-04 02:31:45 +02:00
#
#. /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."
2011-05-04 02:31:45 +02:00
exit 0
}
PIDFILE=/var/run/autodist/autodist.pid
HOUR=`date +%H`
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
}
}
for r in $PORT_REPOSITORIES; do
echo "Autoport start at `date`" > /var/autodist/log/autoport-$r.log
echo "========================" >> /var/autodist/log/autoport-$r.log
done
for a in $CHROOT_ARCHS; do
# 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-$r.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-$r.log
2011-05-04 02:31:45 +02:00
for r in $PORT_REPOSITORIES; 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
/usr/sbin/chroot /var/autoport/$a su -l sdk -c "autoport -b -r $r" >> $local_ftp/$r/autoport-$a.log
cat /var/autoport/$a/home/sdk/.autoport/$a/log >> $local_ftp/$r/autoport-$a.log
echo >> $local_ftp/$r/autoport-$a.log
2011-05-04 02:31:45 +02:00
done
done
for a in $NATIVE_ARCHS; do
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
echo "Updating packages in $a native environment..." >> /var/autodist/log/autoport-$r.log
LANG=C smart update > /dev/null
LANG=C smart upgrade -y >> /var/log/autoupgrade
2011-05-04 02:31:45 +02:00
for r in $PORT_REPOSITORIES; 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
2011-05-04 02:31:45 +02:00
echo >> /var/autodist/log/autoport-$r.log
done
done
for r in $PORT_REPOSITORIES; do
for a in $CROSS_ARCHS; 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
2011-05-04 02:31:45 +02:00
done
done
for r in $PORT_REPOSITORIES; do
cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
done