2011-05-04 02:31:45 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# openmamba-autobuild-autodist daily cron script
|
|
|
|
# (c) 2008-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
|
|
#
|
|
|
|
#. /etc/sysconfig/openmamba-central
|
|
|
|
. /etc/sysconfig/autoport
|
|
|
|
|
|
|
|
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
|
|
|
|
|
|
|
|
ME=`basename $0`
|
|
|
|
[ "$$" == "`pidof -x $ME`" ] || {
|
2012-03-13 15:59:26 +01:00
|
|
|
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
|
|
|
|
echo "Updating packages in $a emulation environment"
|
|
|
|
LANG=C /usr/sbin/chroot /var/autoport/$a smart update
|
|
|
|
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y
|
|
|
|
for r in $PORT_REPOSITORIES; do
|
|
|
|
echo "Working on $r($a) in emulation mode" >> $local_ftp/$r/autoport.log
|
|
|
|
/usr/sbin/chroot /var/autoport/$a su -l sdk -c "autoport -b -r $r" >> $local_ftp/$r/autoport.log
|
|
|
|
cat /var/autoport/arm/home/sdk/.autoport/$a/log >> $local_ftp/$r/autoport.log
|
|
|
|
echo >> $local_ftp/$r/autoport.log
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for a in $NATIVE_ARCHS; do
|
|
|
|
echo "Updating packages in $a native environment"
|
|
|
|
LANG=C smart update
|
|
|
|
LANG=C smart upgrade -y
|
|
|
|
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/autoport/arm/home/sdk/.autoport/$a/log >> $local_ftp/$r/autoport.log
|
|
|
|
echo >> /var/autodist/log/autoport-$r.log
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for r in $PORT_REPOSITORIES; do
|
|
|
|
for a in $CROSS_ARCHS; do
|
|
|
|
echo "Working on $r($a) in cross-platform mode" >> $local_ftp/$r/autoport.log
|
|
|
|
su -l autodist -c "autoport -b -x $a -r $r" >> $local_ftp/$r/autoport.log
|
|
|
|
cat /var/autodist/.autoport/$a/log >> $local_ftp/$r/autoport.log
|
|
|
|
echo >> $local_ftp/$r/autoport.log
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for r in $PORT_REPOSITORIES; do
|
|
|
|
cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
|
|
|
|
done
|