autoport-chroot cron: rework loop to avoid calling more times smart and other things not required
This commit is contained in:
parent
9778194a65
commit
abe0683b5f
@ -32,9 +32,21 @@ function pid_check() {
|
|||||||
pid_check
|
pid_check
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||||
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||||
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||||
|
|
||||||
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
|
# disable service restarts
|
||||||
|
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport
|
||||||
|
ln -s /bin/true /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
|
||||||
|
# sudo mount -o bind /proc /var/autoport/${AUTOPORT_CHROOT[$i]}/proc
|
||||||
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment"
|
||||||
|
#echo "= Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment..." >> $LOGFILE
|
||||||
|
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} smart update --quiet > /dev/null
|
||||||
|
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} smart upgrade -y > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; 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
|
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
|
||||||
CMD_PREFIX=linux32
|
CMD_PREFIX=linux32
|
||||||
@ -57,22 +69,12 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
echo "============================================" >> $LOGFILE
|
echo "============================================" >> $LOGFILE
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
a=${AUTOPORT_CHROOT[$i]}
|
echo "= Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode..." >> $LOGFILE
|
||||||
# sudo mount -o bind /proc /var/autoport/$a/proc
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode" >> $LOGFILE
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
|
#echo "DEBUG: $CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c \"autoport -b -r $r\"" >> $LOGFILE
|
||||||
echo "= Updating packages in $a chroot environment..." >> $LOGFILE
|
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
|
||||||
LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
|
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
|
||||||
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
|
#echo "DEBUG: cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log" >> $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
|
|
||||||
#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
|
fi
|
||||||
|
|
||||||
# if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
# if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
@ -87,15 +89,19 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
# fi
|
# fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||||
a=${AUTOPORT_CROSS[$i]}
|
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode"
|
||||||
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
|
echo "= Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode" >> $LOGFILE
|
||||||
echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
|
su -l autodist -c "autoport -b -x ${AUTOPORT_CROSS[$i]} -r $r" >> $LOGFILE
|
||||||
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
|
cat /var/autodist/.autoport/${AUTOPORT_CROSS[$i]}/$r-current.log >> $LOGFILE
|
||||||
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "- Autoport end at `date`" >> $LOGFILE
|
echo "- Autoport end at `date`" >> $LOGFILE
|
||||||
echo "============================================" >> $LOGFILE
|
echo "============================================" >> $LOGFILE
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
|
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user