45 lines
1.6 KiB
Bash
Executable file
45 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
if [[ -n "$(which webapp-config)" ]] ; then
|
|
|
|
echo "***************** upgrading webapps *******************"
|
|
|
|
for webapp in $(ls /var/db/webapps/ ) ; do
|
|
#we assume a clean system where only ONE app is freshly available and this one app is newer than the currently installed
|
|
available_app=$(webapp-config --list-unused-installs | grep $webapp)
|
|
if [[ -z "$available_app" ]] ; then
|
|
continue
|
|
fi
|
|
new_version=$(echo $available_app|sed -e "s/^${webapp}-\(.*\)$/\1/")
|
|
echo updates for ${webapp}!
|
|
echo new version: $new_version
|
|
for install in $(webapp-config --list-installs $webapp) ; do
|
|
host=$(echo $install | cut -d / -f 4)
|
|
webdir=$(echo $install | cut -d / -f 6-)
|
|
|
|
if [[ -z $webdir ]] ; then
|
|
webdir=""
|
|
dirflag="--dir /"
|
|
else
|
|
dirflag="--dir $webdir"
|
|
fi
|
|
|
|
infostring=$(webapp-config --host $host $dirflag --show-installed)
|
|
echo $infostring
|
|
webapp_version=$(echo $infostring | cut -d\ -f2)
|
|
webapp_test=$(echo $infostring | cut -d\ -f1)
|
|
|
|
if [[ -d /var/www/$host/htdocs/$webdir ]] ; then
|
|
COMMAND="webapp-config --secure --host $host $dirflag -U $webapp $new_version"
|
|
echo upgrade $webapp from $webapp_version to $new_version in $host/$webdir ? type yes to continue, anything else will abort
|
|
echo the command in question:
|
|
echo $COMMAND
|
|
read ANSWEAR
|
|
if [[ $ANSWEAR == "yes" ]] ; then
|
|
$COMMAND
|
|
## CONFIG_PROTECT="/var/www/$host/htdocs/$webdir/" dispatch-conf
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
fi
|