autodist-cgi: complete support for multiple defined repositories in AUTOPORT_REPOSITORIES[]

This commit is contained in:
Silvan Calarco 2012-09-04 13:04:11 +02:00
parent 17c9e4d33a
commit c1ed68dd78
2 changed files with 42 additions and 51 deletions

View File

@ -32,15 +32,17 @@ if [ "$SHOWINDEX" ]; then
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a>&nbsp;"
fi
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a>&nbsp;"
fi
done
done
echo "<br>"
exit 0
@ -59,6 +61,7 @@ if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
else
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
@ -68,11 +71,11 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.log"
AUTODISTLOGFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/${AUTOPORT_REPOSITORIES[$i]}.log"
AUTODISTLOGFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r.log"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}-last.log"
AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/${AUTOPORT_REPOSITORIES[$i]}.log"
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r.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"
@ -98,7 +101,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
break
elif [ "$SHOWLOG" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" ]; then
echo "<h2>$SHOWLOG log in ${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]}):</h2>"
echo "<h2>$SHOWLOG log in $r(${AUTOPORT_ARCH[$i]}):</h2>"
cat << _EOF
<div class=downloadbox align=center>
<div align=left style="background-color: white; height: 550px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
@ -138,17 +141,17 @@ _EOF
[[ "$NUM" && "$NUM" != "$i" ]] && continue
[[ "$HOST" = "$AS_HOST" ]] || continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">${AUTOPORT_REPOSITORIES[$i]}</a>(${AUTOPORT_ARCH[$i]}) (type:autodist update)"
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:autodist update)"
echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">${AUTOPORT_REPOSITORIES[$i]}</a>(${AUTOPORT_ARCH[$i]}) (type:chroot autoport</a> chroot:${AUTOPORT_CHROOT[$i]})"
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:chroot autoport</a> chroot:${AUTOPORT_CHROOT[$i]})"
echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">${AUTOPORT_REPOSITORIES[$i]}</a>(${AUTOPORT_ARCH[$i]}) (type:native autoport)"
echo "<b>* <a href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:native autoport)"
echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
@ -299,6 +302,7 @@ _EOF
# echo
echo "</pre></div></div>"
fi
done
done
# only root host (0) calls other hosts

View File

@ -32,6 +32,7 @@ function pid_check() {
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
@ -45,8 +46,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.log"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}-last.log"
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-${AUTOPORT_CROSS[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}-last.log"
@ -55,10 +56,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
fi
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
# done
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]}
@ -67,17 +66,14 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
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
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
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}.log >> $LOGFILE
done
#$local_ftp/$r/autoport-$a.log
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}.log >> $LOGFILE
fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
@ -86,30 +82,21 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "= Updating packages in $a native environment..." >> $LOGFILE
LANG=C smart update > /dev/null
LANG=C smart upgrade -y >> $LOGFILE
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE
done
echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE
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" >> $LOGFILE
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE
# $local_ftp/$r/autoport-$a.log
done
[[ "`/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/log >> $LOGFILE
fi
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
# 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