Webbuild: support for running a console command from web interface input

This commit is contained in:
Silvan Calarco 2016-05-29 00:23:38 +02:00
parent 7d21e2fa60
commit 2c09744bbd
2 changed files with 24 additions and 0 deletions

View File

@ -2057,6 +2057,15 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"` show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"`
RET=-1 RET=-1
;; ;;
"consolecmd") if [ ! "$SPECVAR_BUILDDIR" ]; then
echo "ERROR: BUILDDIR is undefined"
RET=1
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && bash -c '$CONSOLECMD'"
RET=$?
[ $RET -eq 0 ] && RET=-1
fi
;;
"configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help" "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help"
RET=$? RET=$?
[ $RET -eq 0 ] && RET=-1 ;; [ $RET -eq 0 ] && RET=-1 ;;

View File

@ -139,6 +139,21 @@ function print_showlogcontrols() {
echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);> with status: " echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);> with status: "
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> " echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
echo -n "FAILED <input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\">" echo -n "FAILED <input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\">"
# console cmd
echo -n "<hr><b>Command:</b> "
echo -n " ["
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}@"
else
echo -n "autodist@"
fi
echo -n "`hostname -s` ${SPECVAR_BUILDDIR}]\$ <input type=text id=consolecmd value=\"\" size=\"40\"> "
echo -n "<input type=button id=consolecmdbutton value=\"submit\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=consolecmd&CONSOLECMD=\"+getElementById('consolecmd').value+\"&"
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
# close tag # close tag
echo -n "]]></showlogcontrols>" echo -n "]]></showlogcontrols>"
} }