autoport cron: split autoport cron script into two files to parallelize native and chroot port jobs
This commit is contained in:
parent
1514f95b2b
commit
9a8b1355f7
3
Makefile
3
Makefile
@ -94,7 +94,8 @@ install-data:
|
||||
@$(INSTALL_DATA) etc/sudoers.d/autoport $(DESTDIR)$(sysconfdir)/sudoers.d/autoport
|
||||
@$(INSTALL_DATA) webbuild/webbuild-sudoers $(DESTDIR)$(sysconfdir)/sudoers.d/webbuild
|
||||
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
|
||||
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport-native $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||
@$(INSTALL_SCRIPT) etc/cron.hourly/66-autoport-chroot $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/
|
||||
@$(INSTALL_DATA) autospec-conf $(DESTDIR)$(pck_statedir)/.autospec
|
||||
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.success
|
||||
|
96
etc/cron.hourly/65-autoport-native
Executable file
96
etc/cron.hourly/65-autoport-native
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# openmamba-autobuild-autoport daily cron script
|
||||
# (c) 2008-2012 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`" ] || {
|
||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
|
||||
exit 0
|
||||
}
|
||||
|
||||
PIDFILE=/var/run/autodist/autoport.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
|
||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; 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
|
||||
|
||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
|
||||
|
||||
echo "+ Autoport start at `date`" > $LOGFILE
|
||||
echo "============================================" >> $LOGFILE
|
||||
|
||||
# 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..." >> $LOGFILE
|
||||
# LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
|
||||
# LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
|
||||
# echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
|
||||
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
|
||||
# # disable service restarts
|
||||
# mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
|
||||
# ln -s /bin/true /var/autoport/$a/sbin/service
|
||||
# $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
|
||||
# mv /var/autoport/$a/sbin/service.autoport /var/autoport/$a/sbin/service
|
||||
# cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||
# 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..." >> $LOGFILE
|
||||
LANG=C smart update > /dev/null
|
||||
LANG=C smart upgrade -y >> $LOGFILE
|
||||
echo "= Working on $r($a) in native mode" >> $LOGFILE
|
||||
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
|
||||
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
||||
fi
|
||||
|
||||
# if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
# a=${AUTOPORT_CROSS[$i]}
|
||||
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
|
||||
# echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
|
||||
# su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
|
||||
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
||||
# fi
|
||||
|
||||
echo "- Autoport end at `date`" >> $LOGFILE
|
||||
echo "============================================" >> $LOGFILE
|
||||
|
||||
done
|
||||
done
|
@ -45,9 +45,6 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
|
||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
||||
@ -71,21 +68,23 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
# disable service restarts
|
||||
mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
|
||||
ln -s /bin/true /var/autoport/$a/sbin/service
|
||||
echo "DEBUG: $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c \"autoport -b -r $r\"" >> $LOGFILE
|
||||
$CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
|
||||
mv /var/autoport/$a/sbin/service.autoport /var/autoport/$a/sbin/service
|
||||
cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||
echo "DEBUG: cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log" >> $LOGFILE
|
||||
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..." >> $LOGFILE
|
||||
LANG=C smart update > /dev/null
|
||||
LANG=C smart upgrade -y >> $LOGFILE
|
||||
echo "= Working on $r($a) in native mode" >> $LOGFILE
|
||||
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
|
||||
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
||||
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..." >> $LOGFILE
|
||||
# LANG=C smart update > /dev/null
|
||||
# LANG=C smart upgrade -y >> $LOGFILE
|
||||
# echo "= Working on $r($a) in native mode" >> $LOGFILE
|
||||
# su -l autodist -c "autoport -b -r $r" >> $LOGFILE
|
||||
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
||||
# fi
|
||||
|
||||
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
a=${AUTOPORT_CROSS[$i]}
|
Loading…
Reference in New Issue
Block a user