From 2c09744bbdc91e8df6024b6cd557f517d489a744 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 29 May 2016 00:23:38 +0200 Subject: [PATCH] Webbuild: support for running a console command from web interface input --- webbuild/webbuild-cgi | 9 +++++++++ webbuild/webbuild-functions-private | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index a90cbd1..9b6e777 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -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"` 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" RET=$? [ $RET -eq 0 ] && RET=-1 ;; diff --git a/webbuild/webbuild-functions-private b/webbuild/webbuild-functions-private index 104d42d..194ec2e 100644 --- a/webbuild/webbuild-functions-private +++ b/webbuild/webbuild-functions-private @@ -139,6 +139,21 @@ function print_showlogcontrols() { echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);> with status: " echo -n "OK " echo -n "FAILED " + # console cmd + echo -n "
Command: " + 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}]\$ " + echo -n "" # close tag echo -n "]]>" }