diff --git a/autodist-cgi b/autodist-cgi index dd3316b..6bdeb7c 100755 --- a/autodist-cgi +++ b/autodist-cgi @@ -4,6 +4,7 @@ NUM=`echo "$QUERY_STRING" | sed -n 's/^.*NUM=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` HOST=`echo "$QUERY_STRING" | sed -n 's/^.*HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` +REP=`echo "$QUERY_STRING" | sed -n 's/^.*REP=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` AS_HOST=`echo "$QUERY_STRING" | sed -n 's/^.*AS_HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` SHOWINDEX=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWINDEX=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"` @@ -49,15 +50,17 @@ if [ "$SHOWINDEX" ]; then [ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue + RNUM=-1 for r in ${AUTOPORT_REPOSITORIES[$i]}; do + RNUM=`expr $RNUM + 1` if [ "${AUTOPORT_UPDATE[$i]}" ]; then - echo "$r(${AUTOPORT_ARCH[$i]}) " + echo "$r(${AUTOPORT_ARCH[$i]}) " elif [ "${AUTOPORT_CHROOT[$i]}" ]; then - echo "$r(${AUTOPORT_ARCH[$i]}) " + echo "$r(${AUTOPORT_ARCH[$i]}) " elif [ "${AUTOPORT_NATIVE[$i]}" ]; then - echo "$r(${AUTOPORT_ARCH[$i]}) " + echo "$r(${AUTOPORT_ARCH[$i]}) " elif [ "${AUTOPORT_CROSS[$i]}" ]; then - echo "$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]}) " + echo "$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]}) " fi done done @@ -74,7 +77,7 @@ fi [ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "

Host: `hostname -s` (`uname -m`, kernel `uname -r`)

" if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then - curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&LOG=$LOG" 2>/dev/null + curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&REP=$REP&LOG=$LOG" 2>/dev/null else for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do @@ -96,11 +99,11 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do RELOADTIME=15000 break fi - RNUM=0 + RNUM=-1 for r in ${AUTOPORT_REPOSITORIES[$i]}; do [ "${AUTOPORT_ARCH[$i]}" ] || continue [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue - + RNUM=`expr $RNUM + 1` LOGDIR=`environment_logdir $i` AUTOPORTLOGDIR=`environment_autoport_logdir $i` ENVROOTDIR=`environment_rootdir $i` @@ -127,7 +130,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do continue fi if [ "$SHOWLOG" ]; then - if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$RNUM" ]; then + if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" -a "$REP" = "$RNUM" ]; then echo -n "

$SHOWLOG log in " if [ "${AUTOPORT_UPDATE[$i]}" ]; then echo -n "update" @@ -164,8 +167,8 @@ _EOF echo "" for t in prepare update build install send; do echo -n "" || echo "" - [ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "" || echo "" + [ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "" || echo "" + [ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "" || echo "" echo "" done echo "
Last ${SHOWLOGPKG} logs:
$t:" - [ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "OKFAILEDOKFAILED
" @@ -193,23 +196,23 @@ _EOF [[ "$NUM" && "$NUM" != "$i" ]] && continue [[ "$HOST" = "$AS_HOST" ]] || continue if [ "${AUTOPORT_UPDATE[$i]}" ]; then - echo "* $r(${AUTOPORT_ARCH[$i]}) (type:autodist update)" - echo " [ log last ]" + echo "* $r(${AUTOPORT_ARCH[$i]}) (type:autodist update)" + echo " [ log last ]" fi if [ "${AUTOPORT_CHROOT[$i]}" ]; then - echo "* $r(${AUTOPORT_ARCH[$i]}) (type:chroot autoport chroot:${AUTOPORT_CHROOT[$i]})" - echo " [ log last ]" + echo "* $r(${AUTOPORT_ARCH[$i]}) (type:chroot autoport chroot:${AUTOPORT_CHROOT[$i]})" + echo " [ log last ]" fi if [ "${AUTOPORT_NATIVE[$i]}" ]; then - echo "* $r(${AUTOPORT_ARCH[$i]}) (type:native autoport)" - echo " [ log last ]" + echo "* $r(${AUTOPORT_ARCH[$i]}) (type:native autoport)" + echo " [ log last ]" fi if [ "${AUTOPORT_CROSS[$i]}" ]; then - echo "* cross-platform autoport (arch:${AUTOPORT_CROSS[$i]})" - echo " [ last ]" + echo "* cross-platform autoport (arch:${AUTOPORT_CROSS[$i]})" + echo " [ last ]" fi cat << _EOF
@@ -309,23 +312,23 @@ _EOF # fi case $OPERATIONNAME-$OPERATIONSTATUS in build-ok|send-ok|install-ok|retryinstall-ok) - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" ;; update-failed|autoupdate-failed) if [ "${BUILDNOWSTATUS[$b]}" = "4" ]; then - echo -n "$OPERATIONNAME:up-to-date" + echo -n "$OPERATIONNAME:up-to-date" elif [ "${BUILDNOWSTATUS[$b]}" = "3" ]; then - echo -n "$OPERATIONNAME:unknown" + echo -n "$OPERATIONNAME:unknown" elif [ "${BUILDNOWSTATUS[$b]}" = "2" ]; then - echo -n "$OPERATIONNAME:newer" + echo -n "$OPERATIONNAME:newer" else - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" fi ;; - *-ok) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + *-ok) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" ;; *) - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" ;; esac # [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "($SUBJOBNAME)" @@ -342,14 +345,13 @@ _EOF if [ "$ENDTIME" ]; then echo "End: $ENDTIME" elif [ "$AUTODIST_PID" ]; then - echo "End: in progress" + echo "End: in progress" fi echo # grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||" # echo echo "
" fi - RNUM=`expr $RNUM + 1` done done @@ -357,7 +359,7 @@ done if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do if [ "$NUM" -a "$HOST" = "$h" ]; then - curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&HOST=$HOST" 2>/dev/null + curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&REP=$RNUM&HOST=$HOST" 2>/dev/null elif [ ! "$NUM" ]; then curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null fi