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,16 +32,18 @@ if [ "$SHOWINDEX" ]; then
[ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
if [ "${AUTOPORT_UPDATE[$i]}" ]; then if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;" echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;" echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]})</a>&nbsp;" echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a>&nbsp;" echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a>&nbsp;"
fi fi
done done
done
echo "<br>" echo "<br>"
exit 0 exit 0
elif [ "$AS_HOST" = "0" ]; then elif [ "$AS_HOST" = "0" ]; then
@ -59,6 +61,7 @@ if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
else else
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && 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 elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log" LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.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 elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}.log" LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}-last.log" LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/${AUTOPORT_REPOSITORIES[$i]}.log" AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r.log"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then elif [ "${AUTOPORT_CROSS[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}.log" LOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}-last.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 break
elif [ "$SHOWLOG" ]; then elif [ "$SHOWLOG" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" ]; 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 cat << _EOF
<div class=downloadbox align=center> <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;"> <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 [[ "$NUM" && "$NUM" != "$i" ]] && continue
[[ "$HOST" = "$AS_HOST" ]] || continue [[ "$HOST" = "$AS_HOST" ]] || continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then 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>" echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi fi
if [ "${AUTOPORT_CHROOT[$i]}" ]; then 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>" echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then 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>" echo " [ <a href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi fi
@ -300,6 +303,7 @@ _EOF
echo "</pre></div></div>" echo "</pre></div></div>"
fi fi
done done
done
# only root host (0) calls other hosts # only root host (0) calls other hosts
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then

View File

@ -32,6 +32,7 @@ function pid_check() {
pid_check pid_check
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && 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" LOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.log" LASTLOGFILE="/var/autodist/log/autoport-chroot-${AUTOPORT_CHROOT[$i]}-last.log"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}.log" LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-${AUTOPORT_REPOSITORIES[$i]}-${AUTOPORT_ARCH[$i]}-last.log" LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then elif [ "${AUTOPORT_CROSS[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}.log" LOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-cross-${AUTOPORT_CROSS[$i]}-last.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 fi
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE [ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "+ Autoport start at `date`" > $LOGFILE echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE echo "============================================" >> $LOGFILE
# done
if [ "${AUTOPORT_CHROOT[$i]}" ]; then if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]} a=${AUTOPORT_CHROOT[$i]}
@ -67,7 +66,6 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "= Updating packages in $a chroot environment..." >> $LOGFILE 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 >> $LOGFILE 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 echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
[[ "`/usr/bin/tty`" != "not a tty" ]] && 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 # disable service restarts
@ -76,8 +74,6 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
$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 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 cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/${r}.log >> $LOGFILE
done
#$local_ftp/$r/autoport-$a.log
fi fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then 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 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 >> $LOGFILE LANG=C smart upgrade -y >> $LOGFILE
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "= Working on $r($a) in native mode" >> $LOGFILE echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l autodist -c "autoport -b -r $r" >> $LOGFILE su -l autodist -c "autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE cat /var/autodist/.autoport/$a/log >> $LOGFILE
done
fi fi
if [ "${AUTOPORT_CROSS[$i]}" ]; then if [ "${AUTOPORT_CROSS[$i]}" ]; then
a=${AUTOPORT_CROSS[$i]} 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" [[ "`/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 echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE cat /var/autodist/.autoport/$a/log >> $LOGFILE
# $local_ftp/$r/autoport-$a.log
done
fi fi
echo "- Autoport end at `date`" >> $LOGFILE echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE echo "============================================" >> $LOGFILE
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do done
# [ -e /var/autodist/log/autoport-$r.log ] && \
# cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
# done
done done