Update autoport cron script to manage vectorial configuration for multiple different port jobs

NOTE: requires updating /etc/sysconfig/autoport
This commit is contained in:
Silvan Calarco 2012-05-09 17:29:23 +02:00
parent eedc6e37fb
commit 837842d834
2 changed files with 75 additions and 46 deletions

View File

@ -16,6 +16,7 @@ ME=`basename $0`
PIDFILE=/var/run/autodist/autodist.pid
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function pid_check() {
@ -28,49 +29,70 @@ function pid_check() {
}
}
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
pid_check
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
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
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
echo "ARCH=${AUTOPORT_ARCH[$i]} CHROOT=${AUTOPORT_CHROOT[$i]} \
CROSS=${AUTOPORT_CROSS[$i]} NATIVE=${AUTOPORT_NATIVE[$i]} \
REPOSITORIES=${AUTOPORT_REPOSITORIES[$i]} CMD_PREFIX=$CMD_PREFIX"
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
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
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
echo >> /var/autodist/log/autoport-$r.log
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 sdk -c "autoport -b -r $r" >> $local_ftp/$r/autoport-$a.log
cat /var/autoport/$a/home/sdk/.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
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
done
done
for r in $PORT_REPOSITORIES; do
cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
done

View File

@ -1,10 +1,17 @@
#
# autoport global configuration
#
#AUTOPORT_ENABLE=1
#CHROOT_ARCHS=x86_64
#CROSS_ARCHS=
#NATIVE_ARCHS=
#PORT_REPOSITORIES="devel-makedist"
local_ftp=/var/ftp/pub/openmamba/
#AUTOPORT_ENABLE=1
#AUTOPORT_ARCH[0]=x86_64
#AUTOPORT_CHROOT[0]=devel-x86_64
#AUTOPORT_CROSS[0]=
#AUTOPORT_NATIVE[0]=
#AUTOPORT_REPOSITORIES[0]="devel-makedist"
#AUTOPORT_ARCH[1]=i586
#AUTOPORT_CHROOT[1]=milestone2-i586
#AUTOPORT_CROSS[1]=
#AUTOPORT_NATIVE[1]=
#AUTOPORT_REPOSITORIES[1]="milestone2-makedist"