webbuild: added RPM manager

This commit is contained in:
Silvan Calarco 2013-06-05 18:31:55 +02:00
parent 24f394ce84
commit aeec210b02
3 changed files with 123 additions and 1 deletions

View File

@ -113,6 +113,46 @@ input[type="checkbox"] {
z-index:20;
}
.windowcontainer {
text-align:center;
position:fixed;
z-index:10 !important;
height:100%;
width:100%;
left:0;
top:0;
}
.windowopaquebackground {
text-align:center;
position:fixed;
z-index:10 !important;
height:100%;
width:100%;
left:0;
top:0;
background-color:black;
filter: alpha(opacity=75);
-khtml-opacity:0.75;
-webkit-opacity:0.75;
-moz-opacity:0.75;
opacity:0.75;
}
.windowbox {
display:inline-block;
position:relative;
font-size:10pt;
padding:5px;
margin:100px;
margin-right:auto;
margin-left:auto;
width:auto;
background-color:white;
border:2px solid #2b6600;
z-index:15;
}
.multiselect {
font-size:8pt;
border:0px;

View File

@ -466,6 +466,53 @@ if [ "$REQUEST" = "environmentsearch" ]; then
exit
fi
# install rpms window
if [ "$REQUEST" = "rpmmanager" ]; then
environment_descr=`print_environment_descr $i`
echo -n "<window><![CDATA["
echo -n "<div class=windowcontainer><div class=windowopaquebackground></div>"
echo -n "<div class=windowbox><div style=\"overflow:auto;width:600px;height:400px\">"
echo -n "RPM manager for <b>$environment_descr</b> environment<br>"
echo -n "<div style=\"text-align:left\"><label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('rpmmanagercheckbox',this.checked);>select/unselect all</label></div>"
echo -n "<div class=multiselect style=\"height:350px;text-align:left;\">"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t ../RPMS/${AUTOPORT_ARCH[$ENVIRONMENT]}/*.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm ../RPMS/noarch/*.noarch.rpm 2>/dev/null" | \
while read f; do
pkgname=`basename $f`
echo -n "<label><input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname}</label>"
done
echo -n "</div>"
echo -n "</div>"
if [ "$USER_CANINSTALL" ]; then
# force rpm install/upgrade operation
echo -n "<label style=\"background-color:red;padding:1px;\"><input type=checkbox id=\"rpmmanagerforce\" value=\"force\">force&nbsp;</label>&nbsp;&nbsp;"
# rpm manager install packages
echo -n "<input type=button value=\"install\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerinstall\""
echo -n ",\"`cgi_encodevar "Install <b>"`\"+p+"
echo -n "\"`cgi_encodevar "</b> in <b>$environment_descr</b> environment?"`\""
echo -n ");>&nbsp;&nbsp;"
# rpm manager upgrade packages
echo -n "<input type=button value=\"upgrade\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerupgrade\""
echo -n ",\"`cgi_encodevar "Upgrade <b>"`\"+p+"
echo -n "\"`cgi_encodevar "</b> in <b>$environment_descr</b> environment?"`\""
echo -n ");>"
fi
echo -n "<br><a href=# onclick=clearid(\"window\")>CLOSE</a></div></div>"
echo "]]></window></webbuild>"
exit
fi
# set current user environment if not passed
if [ ! "$ENVIRONMENT" ]; then
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
@ -1870,6 +1917,36 @@ case $REQUEST in
RET=$?
[ $RET -eq 0 ] && RET=-1
;;
"rpmmanagerinstall"|"rpmmanagerupgrade") if [ "$USER_CANINSTALL" ]; then
[ "$RPMMANAGERFORCE" = "true" ] && rpmforceadd="--force"
echo -n "<script>clearid(\"window\")</script>"
for f in $RPMMANAGERPACKAGES; do
if [ "$f/.${AUTOPORT_ARCH[$ENVIRONMENT]}." != "$f" ]; then
installpackages="$installpackages ../RPMS/${AUTOPORT_ARCH[$ENVIRONMENT]}/$f"
elif [ "$f/.noarch." != "$f" ]; then
installpackages="$installpackages ../RPMS/noarch/$f"
else
echo "<font color=red>ERROR: invalid package $f;aborting.</font>"
break
fi
done
if [ "$installpackages" ]; then
if [ "$REQUEST" = "rpmmanagerinstall" ]; then
echo "Installing packages: $RPMMANAGERPACKAGES<br>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
echo "Upgrading packages: $RPMMANAGERPACKAGES<br>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
fi
RET=$?
else
echo "<font color=red>ERROR: no packages to install.</font>"
RET=1
fi
else
echo "<font color=red>ERROR: install capability disabled for user.</font>"
RET=1
fi ;;
*) RET=0 ;;
esac

View File

@ -107,7 +107,7 @@ function showEnvironmentPanel() {
local binutils_ver=`echo $toolchain_output | sed "s|.*GNU \(.*\) (GNU Binutils.*)\(.*\)|\1 \2|"`
echo "Toolchain: gcc $gcc_ver, $binutils_ver"
# smart upgrade
# system upgrade
echo -n "<br><input type=button id=smartupgrade value=\"system upgrade\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=smartupgrade\""
@ -118,6 +118,11 @@ function showEnvironmentPanel() {
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
#echo -n "REQUEST=runldconfig\");>"
# rpm manager
echo -n "<input type=button id=rpmmanager value=\"RPM manager\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=rpmmanager\");>"
# environment search
echo -n "<br><div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "