#!/bin/bash # # webbuild cgi script # Copyright (c) 2012 by Silvan Calarco # . /etc/sysconfig/autoport . /usr/share/autodist/webbuild-functions function print_environment_descr() { local i=$1 if [ "${AUTOPORT_CHROOT_USER[$i]}" ]; then echo -n "${AUTOPORT_CHROOT_USER[$i]} " else echo -n "autodist " fi if [ "${AUTOPORT_UPDATE[$i]}" ]; then echo -n "autoupdate" elif [ "${AUTOPORT_CHROOT[$i]}" ]; then echo -n "chroot" elif [ "${AUTOPORT_NATIVE[$i]}" ]; then echo -n "native" elif [ "${AUTOPORT_CROSS[$i]}" ]; then echo -n "cross" else echo -n "unknown type" fi echo -n " for ${AUTOPORT_ARCH[$i]} (${AUTOPORT_BASE_REPOSITORY[$i]} based)" } # register all GET and POST variables cgi_getvars BOTH ALL #[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED= [ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED= #cgi_getvars POST if [ "$REQUEST" != "refresh" ]; then # echo "`date` - $QUERY_STRING_POST" >> $LOG echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG fi [ "$HOST" ] || HOST=0 [ "$AS_HOST" ] || AS_HOST=0 [ "$AS_HOST" -a "$HOST" != "0" ] && HOST_ADD="&HOST=$HOST" if [ "$AS_HOST" = "0" ]; then echo -e "Content-type: text/xml\nPragma: no-cache\n" # echo -e "Content-Length: 10485\n" echo -n "" else echo -e "Content-type: text/html; charset=UTF-8\n" fi # SECURITY USER_ENABLED= USER_ADMIN= USER_CANMAINTAIN= USER_CANSENDMESSAGES= USER=${USER/.*\/} if [ "$SECRET" -a "$USER" ]; then if [ -r "$WEBBUILD_STATEDIR/users/$USER.conf" ]; then . $WEBBUILD_STATEDIR/users/$USER.conf fi if [ "$USER_ENABLED" ]; then USER_ENABLED= if [ "$SECRET" = "$USER_SECRET" ]; then USER_ENABLED=1 elif [ ! "$SECRET" ]; then USER_ENABLED= elif [ "$USER_SECRET" ]; then echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n "'$SECRET'='$USER_SECRET' Unauthorized! If this happened after you changed your password in openmamba website please ask the maintainer to be re-enabled to use this service. Thank you." echo -n "" echo -n " " echo -n "" exit elif [ "$REQUEST" = "password" ]; then /usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null if [ $? -eq 0 ]; then tmpfile=`mktemp --suffix=webbuildtmp` cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile echo "USER_SECRET='$SECRET'" >> $tmpfile USER_ENABLED=1 $SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf" else USER_ENABLED= fi else # no "$USER_SECRET" set; require password echo -n "" echo -n " " echo -n "]]>" echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n "" exit fi fi fi if [ "$USER_ENABLED" != "1" ]; then echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " if [ "$USER" -a "$SECRET" ]; then if [ "$REQUEST" = "enablerequest" ]; then echo "`date` - USER=$USER USER_EMAIL=$USER_EMAIL REQUEST=$REQUEST SECRET=$SECRET" >> $WEBBUILD_STATEDIR/requests_log echo -n "Your request has been submitted. Please wait for approval and retry later." elif [ "$REQUEST" = "password" ]; then echo -n "Invalid password. Please reload and retry or ask the maintainer in case of problems." elif [ "`grep \" USER=$USER \" $WEBBUILD_STATEDIR/requests_log`" ]; then echo -n "Your request is pending for approval. Please try again later or ask the maintainer in case of problems." else echo -n "" echo -n "]]>" fi # else # echo -n "Unauthorized!" fi echo -n " " # echo -n "" # exit fi if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then . $WEBBUILD_STATEDIR/users/webbuild.state else touch $WEBBUILD_STATEDIR/users/webbuild.state fi if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then set_user_state_var STATE_FAKEUSER FAKEUSER= else set_user_state_var STATE_FAKEUSER $FAKEUSERSWITCH fi fi if [ "$USER" -a "$USER_ENABLED" ]; then # set user state changes if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then set_user_state_var STATE_ADVANCEDCONTROLS 1 else set_user_state_var STATE_ADVANCEDCONTROLS fi fi if [ "$PRIVACYMODESWITCH" != "" ]; then if [ "$PRIVACYMODESWITCH" = "true" ]; then set_user_state_var STATE_PRIVACYMODE 1 else set_user_state_var STATE_PRIVACYMODE fi fi # read user state file [ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state if [ "$USER_ADMIN" -a "$STATE_FAKEUSER" != "" ]; then USER=$STATE_FAKEUSER USER_ENABLED= USER_ADMIN= USER_CANMAINTAIN= USER_CANINSTALL= USER_ALLENVIRONMENTS= USER_ALLREPOSITORIES= [ -e $WEBBUILD_STATEDIR/users/$USER.conf ] && . $WEBBUILD_STATEDIR/users/$USER.conf STATE_ADVANCEDCONTROLS= [ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state fi else USER= fi # # Public requests # if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then [ -e "$WEBBUILD_STATEDIR/social_log" ] || exit # social box echo -n "" count=0 if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then if [ "$USER" ]; then line=`tac $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " | head -n 25 | tail -n 1` else line=`tac $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " | head -n 25 | tail -n 1` fi eval $line FROMID=$SID fi tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do STYPE= SPRIVACY= SUSER= STARGET= SID= eval $line [ "$SID" ] || continue [ $SID -ge $FROMID ] || continue [ "$STARGET" = "developers" -a ! "$USER" ] && continue [ "$SUSER" = "$USER" -a "$STYPE" != "broadcastmessage" ] && continue if [ "$SPRIVACY" -a ! "$USER" ]; then USER_GRAVATAR= else USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"` fi echo -n "" echo -n "" if [ "$SPRIVACY" -a ! "$USER" ]; then SUSER="A developer" fi echo -n "
$SUSER $STEXT

" echo -n "

]]>
" count=`expr $count + 1` done echo -n "
" fi if [ "$USER_ENABLED" != "1" ]; then echo -n "" exit fi # # Enabled users requests # # kill processes or clean log if [ "$REQUEST" = "killtree" ]; then killline=`grep "^$KILLPID " $WEBBUILD_STATEDIR/processes` if [ "$killline" ]; then if [ $KILLPID -ge 1 ]; then [ -e /proc/$KILLPID ] && $SUDO_WRAPPER killtree $KILLPID "$USER" set -- $killline rm -f $5 sed -i "/^$KILLPID /d" $WEBBUILD_STATEDIR/processes else echo "ERROR: Invalid PID" fi fi REQUEST=refresh fi # refresh processes list if [ "$REQUEST" = "refresh" ]; then echo -n "" echo -n "Webbuild jobs: (please click on [x] to clean your build logs when you are done)
" } echo -n "$2 on `print_environment_descr $3`: " if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then echo -n "\"" echo -n "$cmdline\" " echo -n "(running...)" else echo -n "\"" echo -n "$cmdline\" " if [ $RETCODE -eq 256 ]; then $SUDO_WRAPPER finishprocess $1 "$USER" $5 RETCODE=$? fi if [ $RETCODE -eq 0 ]; then echo -n "OK" else echo -n "ERROR ($RETCODE)" fi fi if [ "$2" = "$USER" -o "$USER_ADMIN" ]; then if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then echo -n " [" echo -n "kill" else echo -n " [" echo -n "x" fi echo -n "]" fi echo -n "
" # fi done < $WEBBUILD_STATEDIR/processes [ $numprocess -gt 0 ] && echo -n "" echo -n "]]>
" exit fi # message send request (social_log) if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then # external (autodist) social messages [ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`" echo "" exit fi # repsearch request if [ "$REQUEST" = "repsearch" ]; then echo -n "Console output:
" echo -n "
"
   $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository search -i $REPSEARCHTEXT"
   echo -n "
" echo "
]]>
" exit fi # set current user environment if not passed if [ ! "$ENVIRONMENT" ]; then for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do [ "${AUTOPORT_ARCH[$i]}" ] || continue if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then ENVIRONMENT=$i break fi if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" ]; then ENVIRONMENT=$i fi done [ "$ENVIRONMENT" ] || ENVIRONMENT=$DEFAULT_ENVIRONMENT fi if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then WORKINGROOT="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/" WORKINGHOME="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/usr/src/" BUILDLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/" AUTOPORTLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then WORKINGROOT="/" WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6` BUILDLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/" AUTOPORTLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" else WORKINGROOT="/" WORKINGHOME="/var/autodist/" BUILDLOGDIR="/var/autodist/log/" AUTOPORTLOGDIR="/var/autodist/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" fi # show log if [ "$REQUEST" = "showlog" -o "$REQUEST" = "autobuildedit" ]; then echo -n "Console output:" if [ "$LOGTYPE" = "processoutput" -o "$LOGTYPE" = "processtail" ]; then LOGFILES=$LOGFILE else case $LOGTYPE in autoupdate) LOGFILE=update ;; buildinstall|rebuild) LOGFILE=build ;; *) LOGFILE=$LOGTYPE ;; esac if [ "$LOGSTATUSOK" = "true" ]; then LOGFILE=$LOGFILE/ok else LOGFILE=$LOGFILE/failed fi LOGFILE1=$LOGFILE/$PACKAGE.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE2=$LOGFILE/${PACKAGE}__*.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE3=$LOGFILE/*_${PACKAGE}__*.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE4=$LOGFILE/*_${PACKAGE}.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILES="$BUILDLOGDIR/$LOGFILE1 $BUILDLOGDIR/$LOGFILE2 $BUILDLOGDIR/$LOGFILE3 $BUILDLOGDIR/$LOGFILE4" fi echo "
" for f in $LOGFILES; do [ -r $f ] || continue LOGFILESIZE=`stat -c %s $f` echo -n "`basename $f` (`stat -c %y $f`; $LOGFILESIZE)
"
      if [ "$LOGTYPE" = "processtail" ]; then
         echo -n ""
         tail -n +0 -f $f --pid $PROCESSPID | sed "s|<|\<|g"
         echo -n ""
      else
         if [ $LOGFILESIZE -lt 64512 ]; then
            cat $f | parse_build_output $PACKAGE
#            sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g;
#                          s|^\([\+#] .*\)|\1|;
#                          s|\(.*error[[:space:]]*:[[:space:]]*\)\(.*\)|\1\2|i;
#                          s|^\([%?=][%!=>] .*\)|\1|" | google_search $PACKAGE
##                          s|\(.*error[[:space:]]*:.*\)|\1|i;
         else
            head -c 31744 $f | parse_build_output $PACKAGE
#            sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g;
#                          s|^\([\+#] .*\)|\1|;
#                          s|\(.*error[[:space:]]*:.*\)|\1|i;
#                          s|^\([%?=][%!=>] .*\)|\1|"
            echo "
<------ CUT (long file) ------->" tail -c 31744 $f | parse_build_output $PACKAGE # sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g; # s|^\([\+#] .*\)|\1|; # s|\(.*error[[:space:]]*:\)\(.*\)|\1\2|i; # s|^\([%?=][%!=>] .*\)|\1|" fi fi echo -n "
" done echo -n "
]]>
" if [ "$REQUEST" = "autobuildedit" ]; then REQUEST=edit else echo -n "" exit fi fi echo -n "" # expert mode checkbox [ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED= echo -n " Expert:" # privacy mode checkbox [ "$STATE_PRIVACYMODE" ] && CHECKED="checked=checked" || CHECKED= echo -n " Privacy:" echo -n "" # maintainer mode checkbox if [ "$USER_CANMAINTAIN" ]; then [ "$MAINTAINERMODE" = "true" ] && CHECKED="checked" echo -n "Maintainer:" fi # switch user select if [ "$USER_ADMIN" -o "$STATE_FAKEUSER" ]; then echo -n " | " echo -n " Test user: " fi echo -n "]]>" if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$ENVIRONMENT]}" != "x86_64" ]; then SUDO_WRAPPER="linux32 $SUDO_WRAPPER" fi if [ "$MAINTAINERMODE" = "true" ]; then echo -n " " echo -n " " elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "prepare" ]; then echo -n "Build environment:" echo -n "]]>" # SPECFILES select echo -n "" echo -n "" for f in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls *.spec"`; do specname=${f/.spec} [ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED= echo -n "" done echo -n "]]>" fi [ "$PACKAGE" -a ! "$REQUEST" ] && REQUEST=edit # clean output when changing environment if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then echo -n " " # echo -n "]]>" # echo -n "]]>" fi # REPOSITORIES search if [ ! "$REPSEARCHTEXT" ]; then echo -n "" if [ "$PACKAGE" ]; then echo -n "" else echo -n "" fi echo -n "]]>" fi if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$MAINTAINERMODE" = "true" ]; then # REPOSITORIES select if [ "$MAINTAINERMODE" = "true" -o ! "$REPOSITORY" -o "$REQUEST" = "changeenvironment" ]; then echo -n "" echo -n "" for f in `$SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list"`; do repname=`basename $f` [ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED= if [ "$MAINTAINERMODE" = "true" -a ! "$USER_ALLREPOSITORIES" ]; then for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do [ "$u" = "$repname" ] && echo -n "" done else echo -n "" fi done echo -n "" echo -n "]]>" echo -n " " echo -n " " echo -n " " fi else echo -n "" echo -n " \" onclick=" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&" echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",1).substring(0,getSelectedValueById(\"autobuildedit\",1).indexOf(';')))+\"&" echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&REQUEST=autobuildedit\");>" echo -n " ]]>" echo -n " " echo -n " " echo -n " " fi if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then # PACKAGES (SRPM) select if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then echo -n "" #(getElementById('package').selectedIndex);>" echo "" SRPMBUTTONDISABLED="disabled=disabled" for f in $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm; do [ -r $f ] || continue pkgname=`basename $f` pkgname=${pkgname/.src.rpm} pkgrel=${pkgname/*-} pkgname=${pkgname/-$pkgrel} pkgver=${pkgname/*-} pkgname=${pkgname/-$pkgver} if [ "$PACKAGE" = "$pkgname" ]; then SELECTED="selected=\"selected\""; SRPMBUTTONDISABLED= else SELECTED= fi echo -n "" done echo -n "" echo -n "]]>" if [ "$MAINTAINERMODE" != "true" ]; then echo -n "" if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then echo -n "" fi echo -n "]]>" fi fi # SPECFILE creation if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then echo -n "" echo -n " name:" echo -n " type:" echo -n " version:" echo -n "" echo "]]>" elif [ "$MAINTAINERMODE" = "true" ]; then echo -n " " fi #else # echo -n " " fi if [ "$REQUEST" = "changespec" ]; then if [ "$PACKAGE" ]; then REQUEST="edit"; fi elif [ "$REQUEST" = "broadcastmessage" ]; then BROADCASTMESSAGE=`echo $BROADCASTMESSAGE | sed "s|<|\<|g"` social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"$BROADCASTMESSAGE"\" STIME=`date +%s`" REQUEST= fi #if [ "$MAINTAINERMODE" != "true" -a ! "$PACKAGE" ]; then # echo " " # echo " " # echo " " #fi if [ "$SPECTEXT" ]; then # save specfile tmpfile=`mktemp --suffix=webbuildspectmp` echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile chmod 644 $tmpfile $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat $tmpfile > $PACKAGE.spec" $tmpfile rm -f $tmpfile fi if [ "$REQUEST" = "edit" -o "$REQUEST" = "prepare" ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on $PACKAGE\" STIME=`date +%s`" fi # Here requests which update the specfile, so editor is refreshed after if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \ "$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" -o \ "$REQUEST" = "autodistprepare" -o "$REQUEST" = "autodistupdate" ]; then echo -n "Console output:
" echo -n "
"
   RET=255
   case $REQUEST in
      "prepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;;
      "updatespec") if [ "$UPDATESPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then
                       echo "ERROR: new version and changelog can't be specified together"
                    elif [ "$REBUILDSPECCHANGELOG" ]; then
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a4 --rebuild --changelog \"$REBUILDSPECCHANGELOG\""
                    elif [ "$UPDATESSPECVERSION" ]; then
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a3,4 $UPDATESPECVERSION"
                    else
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a2:4 $UPDATESPECVERSION"
                    fi
                    RET=$?
                    ;;
      "speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
                       AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec"
                       #DECODEDURL=`cgi_decodevar $SPECCREATEURL`
                       [ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE"
                       [ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION"
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autospec -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE"
                       RET=$?
                       [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on $PACKAGE new package\" STIME=`date +%s`"
#                          --changelog \"package created by $USER from autodist webbuild interface\""
                    else
                       echo "ERROR: both source archive URL and name are needed."
                       RET=1
                    fi
                    ;;
      "renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec"
                    RET=$?
                    [ $RET -eq 0 ] && {
                       social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed $RENAMESPECFROM to $PACKAGE\" STIME=`date +%s`"
                       echo "Specfile $RENAMESPECFROM successfully renamed to $PACKAGE."
                    }
                    ;;
      "deletespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rm -f $PACKAGE.spec"
                    RET=$?
                    [ $RET -eq 0 ] && REQUEST="exit"
                    ;;
      "autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                    autodistjobs=
                    if [ "$AUTODISTPKGS" ]; then
                       for p in $AUTODISTPKGS; do
                          autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                       done
                    else
                       autodistjobs="$AUTODISTJOB"
                    fi
                    $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -p $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
                    RET=$?
                    ;;
      "autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                    autodistjobs=
                    if [ "$AUTODISTPKGS" ]; then
                       for p in $AUTODISTPKGS; do
                          autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                       done
                    else
                       autodistjobs="$AUTODISTJOB"
                    fi
                    $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -u $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
                    RET=$?
                    ;;
   esac
   echo -n "
" if [ $RET -eq 0 ]; then echo "Result: OK" else echo "Result: ERROR ($RET)" fi echo -n "
" echo -n "]]>
" if [ "$REQUEST" = "exit" ]; then echo -n " " echo -n " " echo -n " " echo -n "" exit fi [ $RET -eq 0 ] && REQUEST="edit" || REQUEST= fi # maintainer mode editor if [ "$MAINTAINERMODE" = "true" ]; then if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \ "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then echo -n " " echo -n " " if [ "$REPOSITORY" ]; then echo -n "" echo -n "Recent packages in $REPOSITORY:
" cat $local_ftp/distromatic/$REPOSITORY/_recent.inc echo -n "
Log:
"
         cat $local_ftp/$REPOSITORY/distromatic.log
         echo -n "
" echo -n "" echo -n "]]>
" else echo -n " " fi REQUEST= fi fi if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "changeenvironment" ]; then REQUEST= fi # specfile editor if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then if [ "$PACKAGE" ]; then $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "ls $PACKAGE.spec" [ $? -eq 0 ] && SPECAVAILABLE=1 fi if [ "$SPECAVAILABLE" ]; then echo -n "" echo -n " (specify new version:" echo -n " or changelog for a new release:)" echo -n "]]>" # editor textarea echo -n "$PACKAGE.spec in build environment:" # specfile save echo -n "" # specfile reload echo -n "$PACKAGE.spec?

Warning: current unsaved .spec file changes will be lost."`\");>" # specfile rename echo -n "" echo -n ".spec" # specfile delete echo -n "$PACKAGE.spec?"`\")>" echo -n "]]>
" # else # echo "" # echo "No pre-existing .spec file $PACKAGE.spec in current working environment. Choose package from a repository and press 'Unpack and edit' to edit." # echo -n "" # echo -n "]]>" fi REQUEST= fi # operation panel if [ "$MAINTAINERMODE" != "true" ]; then echo -n "" if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} " else echo -n "autodist " fi if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "autoupdate" elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then echo -n "chroot" elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then echo -n "native" elif [ "${AUTOPORT_CROSS[$ENVIRONMENT]}" ]; then echo -n "cross" else echo -n "unknown type" fi echo -n " for ${AUTOPORT_ARCH[$ENVIRONMENT]}" # smart upgrade echo -n "" echo -n "
" [ "$PACKAGE" ] && echo -n "Package: $PACKAGE
" echo -n "Target arch:" echo -n "" # destination repository select echo -n "
Send to:" echo -n "
" [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "
Autodist batch builds:
" if [ "$PACKAGE" ]; then if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "Patch for $PACKAGE:
" # autodist show patch echo -n "" # autodist remove patch echo -n "$PACKAGE?"`\"); class=redbutton>" # autodist auto patch echo -n "$PACKAGE?
Note: patch type will be autodetected."`\"); class=redboldbutton>" # autodist update patch echo -n "update patch for package $PACKAGE?"`\"); class=redbutton>" # autodist build patch echo -n "build patch for package $PACKAGE?"`\"); class=redbutton>" fi fi if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then # autodist list-jobs [ "$PACKAGE" -a "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ] && echo -n "
" echo -n "Job:" if [ "$AUTODISTJOB" ]; then echo -n "
Job packages:
" for p in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-pkgs $AUTODISTJOB"`; do if [ "$AUTODISTPKGS" ]; then for i in $AUTODISTPKGS; do [ "$i" = "$p" ] && { SELECTED=checked; break; } || SELECTED= done else [ "$p" = "$AUTODISTJOB" ] && SELECTED=checked || SELECTED= fi echo -n "" done echo -n "
" # autodist prepare echo -n "" # autodist update echo -n "" # autodist build echo -n "" # autodist install [ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED= echo -n ""`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " job in current environment?"`\"" echo -n "); class=redbutton $DISABLED>" # autodist send [ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED= echo -n ""`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " job to "`\"+" echo -n "getSelectedValueById('sendrepository')+\"`cgi_encodevar "?"`\"); class=redbutton $DISABLED>" # autodist schedule echo -n "
"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " autodist job for automatic update?"`\"); class=boldbutton>" echo -n "(version:)" # autodist show schedule echo -n "" # autodist unschedule echo -n "" # autodist skip echo -n "
" else echo -n "
" fi # automatic port if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "
Automatic port:" echo -n "$PACKAGE package with current specfile changes?"`\"); class=redbutton>" echo -n "" fi fi if [ "$PACKAGE" ]; then if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then # autodist logs echo -n "
Last autodist logs: " echo -n "OK " echo -n "FAILED
" echo -n "" echo -n "" echo -n "" echo -n "" echo -n "" fi echo -n "
RPM packaging commands:
" # check for updates echo -n "" # unpack echo -n "" # build echo -n "" # unpackaged files echo -n "" # build requirements echo -n "" # recreate SRPM echo -n "" # rpm checks echo -n "" echo -n "" # rpm install [ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" echo -n "$PACKAGE in current environment?"`\"" echo -n "); class=redbutton $DISABLED>" # rpm send echo -n "$PACKAGE built packages to "`\"+getSelectedValueById('sendrepository')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # recreate and send SRPM echo -n "$PACKAGE source package only and send to "`\"+getSelectedValueById('sendrepository')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # add patches echo -n "
Add patches:" echo -n "
" echo -n "URL:" echo -n "As: $PACKAGE-.patch" # info from package sources echo -n "
Info from package in the works:
" # source files echo -n "" # show package licenses echo -n "" # show package build docs echo -n "" # show package configure help echo -n "" # show package configure log echo -n "" # buildroot files echo -n "" # show package changelog echo -n "" # generic info echo -n "
Generic info:
" # allowed groups echo -n "" # approved licenses echo -n "" # macros echo -n "
" echo -n "
" fi echo -n "]]>
" fi echo -n "Message to developers:
" echo -n "" echo -n "" echo -n "]]>
" if [ "$REQUEST" != "" ]; then echo -n "Console output:" echo -n "
" else echo -n "id=outputtop>" fi if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then echo -n "
"
   fi
   RET=255
fi

case $REQUEST in
   "smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
                     RET=$?
                     ;;
   "showpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
   "removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE remove"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "autopatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE auto"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "updatepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE update"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist update patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE build"
                    RET=$?
                    if [ $RET -eq 0 ]; then
                       social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist build patch for $PACKAGE\" STIME=`date +%s`"
                    fi ;;
   "showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule"; RET=$? ;;
   "schedule") if [ "$SCHEDULEVERSION" ]; then
                  $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB#$SCHEDULEVERSION"
                  RET=$?
                  if [ $RET -eq 0 ]; then
                     social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job $AUTODISTJOB for update to version $SCHEDULEVERSION\" STIME=`date +%s`"
                  fi
               else
                  $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB"
                  RET=$?
                  if [ $RET -eq 0 ]; then
                     social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job $PAUTODISTJOB for automatic update\" STIME=`date +%s`"
                  fi
               fi
               ;;
   "unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool unschedule $AUTODISTJOB"
                    RET=$?
                    if [ $RET -eq 0 ]; then
                       social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job $AUTODISTJOB\" STIME=`date +%s`"
                    fi ;;
   "skip") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool skip $AUTODISTJOB"
              RET=$?
              if [ $RET -eq 0 ]; then
                 social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job $AUTODISTJOB to skipped list\" STIME=`date +%s`"
              fi ;;
   "autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                       autodistjobs=
                       if [ "$AUTODISTPKGS" ]; then
                          for p in $AUTODISTPKGS; do
                             autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                          done
                       else
                          autodistjobs="$AUTODISTJOB"
                       fi
                       $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
                       RET=$?
                       #[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built $PACKAGE\" STIME=`date +%s`"
                       ;;
   "autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                      autodistjobs=
                      if [ "$AUTODISTPKGS" ]; then
                         for p in $AUTODISTPKGS; do
                            autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                         done
                      else
                         autodistjobs="$AUTODISTJOB"
                      fi
                      $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
                      RET=$? ;;
   "autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                      autodistjobs=
                      if [ "$AUTODISTPKGS" ]; then
                         for p in $AUTODISTPKGS; do
                            autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                         done
                      else
                         autodistjobs="$AUTODISTJOB"
                      fi
                      $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
                      RET=$?
                      [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent $AUTODISTPKGS to $SENDREPOSITORY\" STIME=`date +%s`"
                      ;;
   "autoport") $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport $PACKAGE -r $REPOSITORY -v"
                  RET=$?
                  ;;
   "buildrootfiles") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;;
   "autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;;
   "rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps"; RET=$? ;;
   "rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
               [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
                  RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
               $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD"
#                 && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
               RET=$?
               ;;
   "srpmbuild") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir @WORKINGHOME@/RPM/SOURCES\" $PACKAGE.spec"
                   RET=$? ;;
   "autospeclistcheck")
                   [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
                      RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
                   $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a5 --list-check $RPMARCHADD"
                   RET=$? ;;
   "autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a6"
                   RET=$? ;;
   "rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a8"; RET=$? ;;
   "rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a7"; RET=$? ;;
   "rpminstall") if [ "$USER_CANINSTALL" ]; then
                       [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install"
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
                    else
                       echo "Install function disabled."
                       RET=1
                    fi ;;
   "sendpackage") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent $PACKAGE to $SENDREPOSITORY\" STIME=`date +%s`"
                     fi ;;
   "sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force --nodeps"
                    if [ "$SENDREPOSITORY" ]; then
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir @WORKINGHOME@/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && autospec -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
                       RET=$?
                    else
                       echo "ERROR: send repository is not defined."
                       RET=255
                    fi ;;
   "addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
                     $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -skL \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
                     RET=$?
                     [ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch"
                  else
                     echo "Patch URL or destination name not provided."
                     RET=1
                  fi ;;
   "repositoryimport")
                      for p in $PACKAGES; do
                         [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
                         [ "$REPOSITORYFORCE" = "true"  ] && FORCEADD="-f"
                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
                         RET=$?
                         if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                            social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`"
                         fi
                         [ $RET -eq 0 ] || break
                      done
                      ;;
   "repositoryrelease")
                      for p in $PACKAGES; do
                         [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
                         [ "$REPOSITORYFORCE" = "true"  ] && SIMULATEADD="$SIMULATEADD -f"
                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
                         RET=$?
                         if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                            social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`"
                         fi
                         [ $RET -eq 0 ] || break
                      done
                      ;;
   "repositorydiff")
                      for p in $PACKAGES; do
                         $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
                         RET=$?
                         [ $RET -eq 0 ] || break
                      done
                      ;;
   "repositoryarchive")
                      for p in $PACKAGES; do
                         [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
                         $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
                         RET=$?
                         if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
                            social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived $p from $SENDREPOSITORY\" STIME=`date +%s`"
                         fi
                         [ $RET -eq 0 ] || break
                      done
                      ;;
   "repositorysync")
                      if [ "$REPOSITORY" ]; then
                         $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
                         RET=$?
                         [ $RET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
                         RET=$?
                         [ $RET -eq 0 ] || break
                      fi
                      ;;
   "autoportnp") $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -v -np $PACKAGE"; RET=$? ;;
   "autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;;
   "allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autospec --eval rpm_allowed_groups"; RET=$? ;;
   "approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autospec --eval rpm_approved_licenses | grep -v \"^#\"" | \
                          while read line; do
                             echo $line
                          done
                          RET=0
                          ;;
   "builddirfiles") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@ && find @BUILDDIR@"; RET=$? ;;
   "showchangelogs"|"showbuilddocs"|"showlicenses")
                       if [ "$REQUEST" = "showchangelogs" ]; then
                          PATTERN="-iname changelog -or -iname news -and -type f"
                       elif [ "$REQUEST" = "showlicenses" ]; then
                          PATTERN="-iname license\* -or -iname copying\* -or -iname authors\* -and -type f"
                       elif [ "$REQUEST" = "showbuilddocs" ]; then
                          PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -and -type f"
                       fi
                       files=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && find . $PATTERN -maxdepth 2"`
                       cnt=0
                       for f in $files; do
                          echo -n "$f
" done echo -n "
" for f in $files; do echo -n "

File $f:

"
                          $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
                             "cd @RPMBUILDDIR@/@BUILDDIR@ && head -c 10240 $f | sed \"s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | \
                             tee /tmp/prova5
                          RET=$?
                          echo -n "
" done ;; "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && ./configure --help"; RET=$? ;; "configurelog") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && cat config.log"; RET=$? ;; "showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"; RET=$? ;; *) RET=0 ;; esac if [ "$REQUEST" != "" ]; then if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then echo -n "
" fi if [ $RET -eq 0 ]; then echo "Result: OK" else echo "Result: ERROR ($RET)" fi echo -n "
" echo -n "]]>
" fi if [ "$MAINTAINERMODE" = "true" ]; then echo -n " " echo -n "Repository maintenance:
" # echo -n "${pkgname} ${pkgver}-${pkgrel}" done echo -n "" echo -n "Origin: $REPOSITORY
" echo -n "Destination: " echo -n "
" # repository compare echo -n "" # repository import echo -n ""`\"+p+\"`cgi_encodevar " from $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # repository release echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # repository archive echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY?"`\"" echo -n "); class=redbutton>" echo -n "" echo -n "" # repository sync echo -n " $REPOSITORY updates immediately available from public server?"`\"" echo -n "); class=redbutton>" fi echo -n "]]>
" fi #if [ ! "$REQUEST" -o "$REQUEST" = "output" ]; then # echo -n "All hosts] [Build hosts monitor]
" # for h in `seq 0 ${#AUTOPORT_CGI_HOST[*]}`; do # curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&SHOWINDEX=1" 2>/dev/null # done # echo "
" # # [ "$HOST" = "$AS_HOST" ] && echo "

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

" # # echo -n "]]>
" #fi echo -n "" if [ "$MAINTAINERMODE" = "true" ]; then [ "$REPOSITORY" ] && echo -n "$REPOSITORY " || echo -n "no repository " echo -n "(Maintainer mode)" else [ "$PACKAGE" ] && echo -n "$PACKAGE " || echo -n "no package " echo -n "(" if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} " else echo -n "autodist " fi if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "autoupdate" elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then echo -n "chroot" elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then echo -n "native" elif [ "${AUTOPORT_CROSS[$ENVIRONMENT]}" ]; then echo -n "cross" else echo -n "unknown type" fi echo -n " for ${AUTOPORT_ARCH[$ENVIRONMENT]})" fi echo -n " :: openmamba webbuild" echo ""