webbuild-cgi: fixes for rpm manager install/upgrade from repositories

This commit is contained in:
Silvan Calarco 2015-01-30 11:11:23 +01:00
parent a6b14a1aa9
commit aca1323856
2 changed files with 6 additions and 13 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# webbuild cgi script
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2012-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /usr/share/autodist/webbuild-functions
. /usr/share/autodist/webbuild-functions-private
@ -579,6 +579,7 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "<input type=button value=\"install\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
@ -590,6 +591,7 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "<input type=button value=\"upgrade\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerupgrade\""
@ -2085,18 +2087,10 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
if [ "$installpackages" ]; then
if [ "$REQUEST" = "rpmmanagerinstall" ]; then
echo "Installing packages: $RPMMANAGERPACKAGES<br>"
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
sudo rpm -i $installpackages $rpmforceadd
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd 2>&1"
elif [ "$REQUEST" = "rpmmanagerupgrade" ]; then
echo "Upgrading packages: $RPMMANAGERPACKAGES<br>"
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
else
sudo rpm -U $installpackages $rpmforceadd
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd 2>&1"
fi
RET=$?
else

View File

@ -275,7 +275,6 @@ function download_file() {
local f
for f in $download_files; do
echo $f >> /tmp/down
echo -e "Content-Type: application/octet-stream"
echo -e "Content-Disposition: attachment; filename=\"${f/*\/}\"\n"
if [ "$download_environment" ]; then
@ -284,7 +283,7 @@ echo $f >> /tmp/down
cat $f 2>/dev/null
fi
done
RET=$?
return $RET
}