This commit is contained in:
Bob Mottram 2018-03-31 13:57:30 +01:00
parent c09b1b1ce4
commit d1a410fa93
1 changed files with 45 additions and 16 deletions

View File

@ -8,8 +8,6 @@
#
# Freedom in the Cloud
#
# Databaseless blogging system
#
# License
# =======
#
@ -35,7 +33,7 @@ SHOW_ON_ABOUT=1
BLUDIT_DOMAIN_NAME=
BLUDIT_CODE=
BLUDIT_ONION_PORT=9361
BLUDIT_ONION_PORT=9929
BLUDIT_REPO="https://github.com/bludit/bludit"
BLUDIT_COMMIT='0e27e31a84421b3e6bd000a77bc89c2dff3c446a'
@ -95,6 +93,35 @@ function reconfigure_bludit {
echo -n ''
}
function configure_interactive_bludit {
while true
do
data=$(mktemp 2>/dev/null)
dialog --backtitle $"Freedombone Control Panel" \
--title $"bludit" \
--radiolist $"Choose an operation:" 16 70 3 \
1 $"Option 1" off \
2 $"Option 2" off \
3 $"Exit" on 2> "$data"
sel=$?
case $sel in
1) rm -f "$data"
return;;
255) rm -f "$data"
return;;
esac
case $(cat "$data") in
1) # call some function for option 1
;;
2) # call some function for option 2
;;
3) rm -f "$data"
break;;
esac
rm -f "$data"
done
}
function upgrade_bludit {
CURR_BLUDIT_COMMIT=$(get_completion_param "bludit commit")
if [[ "$CURR_BLUDIT_COMMIT" == "$BLUDIT_COMMIT" ]]; then
@ -148,6 +175,7 @@ function restore_local_bludit {
chown -R www-data:www-data "$bludit_dir"
rm -rf $temp_restore_dir
fi
fi
}
@ -189,6 +217,7 @@ function restore_remote_bludit {
chown -R www-data:www-data "$bludit_dir"
rm -rf $temp_restore_dir
fi
fi
}
@ -196,6 +225,7 @@ function remove_bludit {
nginx_dissite "$BLUDIT_DOMAIN_NAME"
remove_certs "$BLUDIT_DOMAIN_NAME"
if [ -d "/var/www/$BLUDIT_DOMAIN_NAME" ]; then
rm -rf "/var/www/$BLUDIT_DOMAIN_NAME"
fi
@ -225,20 +255,19 @@ function install_bludit {
if [ -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
rm -rf "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ -d /repos/bludit ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 324687356
git pull
else
git_clone $BLUDIT_REPO "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ -d /repos/bludit ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 324687356
git pull
else
git_clone $BLUDIT_REPO "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
echo $'Unable to clone bludit repo'
exit 87525
fi
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
echo $'Unable to clone bludit repo'
exit 87525
fi
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 36587356
git checkout $BLUDIT_COMMIT -b $BLUDIT_COMMIT