autoport cron: reworked for better logfile management; disable service restarts in chroot mode
This commit is contained in:
parent
c49d56bd9e
commit
b5f570cc0b
@ -41,38 +41,57 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
CMD_PREFIX=
|
CMD_PREFIX=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
echo "Autoport start at `date`" > /var/autodist/log/autoport-$r.log
|
LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log"
|
||||||
echo "========================" >> /var/autodist/log/autoport-$r.log
|
LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.log"
|
||||||
done
|
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
|
LOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_ARCH[$i]}.log"
|
||||||
|
LASTLOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_ARCH[$i]}-last.log"
|
||||||
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||||
|
LOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}.log"
|
||||||
|
LASTLOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}-last.log"
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
|
||||||
|
|
||||||
|
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
|
echo "Autoport start at `date`" > $LOGFILE
|
||||||
|
echo "========================" >> $LOGFILE
|
||||||
|
# done
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
a=${AUTOPORT_CHROOT[$i]}
|
a=${AUTOPORT_CHROOT[$i]}
|
||||||
# sudo mount -o bind /proc /var/autoport/$a/proc
|
# sudo mount -o bind /proc /var/autoport/$a/proc
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
|
[[ "`/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
|
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 update --quiet > /dev/null
|
||||||
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> /var/autodist/log/autoport-chroot-$a.log
|
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
echo "Working on $r($a) in chroot mode..." >> /var/autodist/log/autoport-$r.log
|
echo "Working on $r($a) in chroot mode..." >> $LOGFILE
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" > $local_ftp/$r/autoport-$a.log
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
|
||||||
$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
|
# disable service restarts
|
||||||
cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/log >> $local_ftp/$r/autoport-$a.log
|
mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
|
||||||
echo >> $local_ftp/$r/autoport-$a.log
|
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]}/log >> $LOGFILE
|
||||||
|
echo >> $LOGFILE
|
||||||
done
|
done
|
||||||
|
#$local_ftp/$r/autoport-$a.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
a=${AUTOPORT_ARCH[$i]}
|
a=${AUTOPORT_ARCH[$i]}
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
|
[[ "`/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
|
echo "Updating packages in $a native environment..." >> $LOGFILE
|
||||||
LANG=C smart update > /dev/null
|
LANG=C smart update > /dev/null
|
||||||
LANG=C smart upgrade -y >> /var/log/autoupgrade
|
LANG=C smart upgrade -y >> $LOGFILE
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
echo "Working on $r($a) in native mode" >> /var/autodist/log/autoport-$r.log
|
echo "Working on $r($a) in native mode" >> $LOGFILE
|
||||||
su -l autodist -c "autoport -b -r $r" >> /var/autodist/log/autoport-$r.log
|
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
|
||||||
cat /var/autodist/.autoport/$a/log >> /var/autodist/log/autoport-$r.log
|
cat /var/autodist/.autoport/$a/log >> $LOGFILE
|
||||||
echo >> /var/autodist/log/autoport-$r.log
|
echo >> $LOGFILE
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -80,16 +99,20 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
a=${AUTOPORT_CROSS[$i]}
|
a=${AUTOPORT_CROSS[$i]}
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
|
[[ "`/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
|
echo "Working on $r($a) in cross-platform mode" >> $LOGFILE
|
||||||
su -l autodist -c "autoport -b -x $a -r $r" > $local_ftp/$r/autoport-$a.log
|
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
|
||||||
cat /var/autodist/.autoport/$a/log >> $local_ftp/$r/autoport-$a.log
|
cat /var/autodist/.autoport/$a/log >> $LOGFILE
|
||||||
echo >> $local_ftp/$r/autoport-$a.log
|
echo >> $LOGFILE
|
||||||
|
# $local_ftp/$r/autoport-$a.log
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
echo "Autoport end at `date`" >> $LOGFILE
|
||||||
[ -e /var/autodist/log/autoport-$r.log ] && \
|
echo "========================" >> $LOGFILE
|
||||||
cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
|
|
||||||
done
|
# 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
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user