2012-05-24 16:29:41 +02:00
|
|
|
#!/bin/bash
|
|
|
|
. /etc/sysconfig/autoport
|
|
|
|
|
|
|
|
NUM=`echo "$QUERY_STRING" | sed -n 's/^.*NUM=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
SECONDARY=`echo "$QUERY_STRING" | sed -n 's/^.*SECONDARY=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
SHOWLASTLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLASTLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
LINES=`echo "$QUERY_STRING" | sed -n 's/^.*LINES=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
|
|
|
|
[ "$LINES" ] || LINES=5
|
|
|
|
[ "$SECONDARY" ] && SECONDARY_ADD="&SECONDARY=1"
|
|
|
|
|
2012-05-26 13:28:28 +02:00
|
|
|
echo -e "Content-type: text/html; charset=UTF-8\n\n"
|
2012-05-24 16:29:41 +02:00
|
|
|
|
|
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
|
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
|
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
|
|
|
2012-05-26 13:28:28 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
LOGFILE="/var/autodist/log/autodist.log"
|
|
|
|
LASTLOGFILE="/var/autodist/log/autodist-last.log"
|
|
|
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
2012-05-24 16:29:41 +02:00
|
|
|
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_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
|
|
|
|
|
|
|
|
if [ "$SHOWLOG" -a "$NUM" = "$i" ]; then
|
|
|
|
if [ ! "$SECONDARY" ]; then
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "<pre>"
|
2012-05-24 16:29:41 +02:00
|
|
|
cat $LOGFILE
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "</pre>"
|
2012-05-24 16:29:41 +02:00
|
|
|
else
|
|
|
|
curl "$AUTOPORT_CGI_SECONDARY?SHOWLOG=1&NUM=$i"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
elif [ "$SHOWLASTLOG" -a "$NUM" = "$i" ]; then
|
|
|
|
if [ ! "$SECONDARY" ]; then
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "<pre>"
|
2012-05-24 16:29:41 +02:00
|
|
|
cat $LASTLOGFILE
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "</pre>"
|
2012-05-24 16:29:41 +02:00
|
|
|
else
|
|
|
|
curl "$AUTOPORT_CGI_SECONDARY?SHOWLASTLOG=1&NUM=$i"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
elif [ ! "$SHOWLOG" -a ! "$SHOWLASTLOG" ]; then
|
|
|
|
[[ "$NUM" && "$NUM" != "$i" ]] && continue
|
|
|
|
|
2012-05-26 13:28:28 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
echo "<b>* <a href=\"?SHOWLOG=1&NUM=$i$SECONDARY_ADD\">autodist update</a> (host:`hostname -s`,arch:${AUTOPORT_ARCH[$i]},channels:${AUTOPORT_REPOSITORIES[$i]})"
|
|
|
|
echo " [ <a href=\"?SHOWLASTLOG=1&NUM=$i$SECONDARY_ADD\">last</a> ]</b>"
|
|
|
|
fi
|
|
|
|
|
2012-05-24 16:29:41 +02:00
|
|
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "<b>* <a href=\"?SHOWLOG=1&NUM=$i$SECONDARY_ADD\">chroot autoport</a> (host:`hostname -s`,arch:${AUTOPORT_ARCH[$i]},channels:${AUTOPORT_REPOSITORIES[$i]},chroot:${AUTOPORT_CHROOT[$i]})"
|
2012-05-24 16:29:41 +02:00
|
|
|
echo " [ <a href=\"?SHOWLASTLOG=1&NUM=$i$SECONDARY_ADD\">last</a> ]</b>"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "<b>* <a href=\"?SHOWLOG=1&NUM=$i$SECONDARY_ADD\">native autoport</a> (host:`hostname -s`,arch:${AUTOPORT_ARCH[$i]},channels:${AUTOPORT_REPOSITORIES[$i]})"
|
2012-05-24 16:29:41 +02:00
|
|
|
echo " [ <a href=\"?SHOWLASTLOG=1&NUM=$i$SECONDARY_ADD\">last</a> ]</b>"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
2012-05-26 13:28:28 +02:00
|
|
|
echo "<b>* <a href=\"?SHOWLOG=1&NUM=$i$SECONDARY_ADD\">cross-platform</a> autoport (host:`hostname -s`,arch:${AUTOPORT_CROSS[$i]})</b>"
|
2012-05-24 16:29:41 +02:00
|
|
|
echo " [ <a href=\"?SHOWLASTLOG=1&NUM=$i$SECONDARY_ADD\">last</a> ]</b>"
|
|
|
|
fi
|
|
|
|
echo "<br><pre>"
|
2012-05-26 13:28:28 +02:00
|
|
|
grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
|
2012-05-24 16:29:41 +02:00
|
|
|
echo
|
|
|
|
echo "</pre>"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
[ "$NUM" ] && NUM=`expr $NUM - $i`
|
|
|
|
|
|
|
|
if [ "$AUTOPORT_CGI_SECONDARY" -a ! "$SHOWLOG" -a ! "$SHOWLASTLOG" ]; then
|
|
|
|
curl "$AUTOPORT_CGI_SECONDARY?SECONDARY=1&LINES=$LINES&NUM=$NUM"
|
|
|
|
fi
|