| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 | 
							- #!/bin/bash
 - #
 - # .---.                  .              .
 - # |                      |              |
 - # |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
 - # |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
 - # '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
 - #
 - #                    Freedom in the Cloud
 - #
 - # Hubzilla application
 - #
 - # License
 - # =======
 - #
 - # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
 - #
 - # This program is free software: you can redistribute it and/or modify
 - # it under the terms of the GNU Affero General Public License as published by
 - # the Free Software Foundation, either version 3 of the License, or
 - # (at your option) any later version.
 - #
 - # This program is distributed in the hope that it will be useful,
 - # but WITHOUT ANY WARRANTY; without even the implied warranty of
 - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - # GNU Affero General Public License for more details.
 - #
 - # You should have received a copy of the GNU Affero General Public License
 - # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 - 
 - VARIANTS='full social'
 - 
 - HUBZILLA_DOMAIN_NAME=
 - HUBZILLA_CODE=
 - HUBZILLA_ONION_PORT=8085
 - HUBZILLA_REPO="https://github.com/redmatrix/hubzilla.git"
 - HUBZILLA_THEMES_REPO="https://github.com/DeadSuperHero/redmatrix-themes"
 - HUBZILLA_ADDONS_REPO="https://github.com/redmatrix/hubzilla-addons.git"
 - HUBZILLA_ADMIN_PASSWORD=
 - HUBZILLA_COMMIT='8aee932525d0bc341713fe7052e2a5ab318a69c0'
 - HUBZILLA_ADDONS_COMMIT='4456f097e3faf2adeab696ad08e3f213e82199bd'
 - 
 - function hubzilla_renew_cert {
 -     dialog --title $"Renew SSL certificate" \
 -            --backtitle $"Freedombone Control Panel" \
 -            --yesno $"\nThis will renew a letsencrypt certificate. Select 'yes' to continue" 16 60
 -     sel=$?
 -     case $sel in
 -         1) return;;
 -         255) return;;
 -     esac
 -     HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
 -         dialog --title $"Renew SSL certificate" \
 -                --msgbox $"Hubzilla install directory not found" 6 40
 -         return
 -     fi
 -     ${PROJECT_NAME}-renew-cert -h $HUBZILLA_DOMAIN_NAME -p 'letsencrypt'
 -     if [ ! "$?" = "0" ]; then
 -         any_key
 -     else
 -         dialog --title $"Renew SSL certificate" \
 -                --msgbox $"Hubzilla certificate has been renewed" 6 40
 -     fi
 - }
 - 
 - function hubzilla_channel_directory_server {
 -     if ! grep -q "Hubzilla domain" $COMPLETION_FILE; then
 -         dialog --title $"Hubzilla channel directory server" \
 -                --msgbox $"Hubzilla is not installed on this system" 6 40
 -         return
 -     fi
 -     HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
 -         dialog --title $"Hubzilla channel directory server" \
 -                --msgbox $"Hubzilla install directory not found" 6 40
 -         return
 -     fi
 - 
 -     data=$(tempfile 2>/dev/null)
 -     trap "rm -f $data" 0 1 2 5 15
 -     dialog --title $"Hubzilla channel directory server" \
 -            --backtitle $"Freedombone Control Panel" \
 -            --inputbox $"When you click on 'channel directory' this is where Hubzilla will obtain its list from" 8 60 2>$data
 -     sel=$?
 -     case $sel in
 -         0)
 -             hubzilla_domain_server=$(<$data)
 -             if [[ $hubzilla_domain_server != *"."* ]]; then
 -                 return
 -             fi
 -             if [[ $hubzilla_domain_server != "https"* ]]; then
 -                 dialog --title $"Hubzilla channel directory server" \
 -                        --msgbox $"Invalid domain - include the https://" 6 40
 -                 return
 -             fi
 -             ./var/www/$HUBZILLA_DOMAIN_NAME/htdocs/util/config system directory_server $hubzilla_domain_server
 -             dialog --title $"Hubzilla channel directory server" \
 -                    --msgbox $"Domain channel directory server changed to $hubzilla_domain_server" 6 40
 -             ;;
 -     esac
 - }
 - 
 - function configure_interactive_hubzilla {
 -     while true
 -     do
 -         data=$(tempfile 2>/dev/null)
 -         trap "rm -f $data" 0 1 2 5 15
 -         dialog --backtitle $"Freedombone Control Panel" \
 -                --title $"Hubzilla" \
 -                --radiolist $"Choose an operation:" 13 70 4 \
 -                1 $"Set channel directory server" off \
 -                2 $"Renew SSL certificate" off \
 -                3 $"Back to main menu" on 2> $data
 -         sel=$?
 -         case $sel in
 -             1) break;;
 -             255) break;;
 -         esac
 -         case $(cat $data) in
 -             1) hubzilla_channel_directory_server;;
 -             2) hubzilla_renew_cert;;
 -             3) break;;
 -         esac
 -     done
 - }
 - 
 - function install_interactive_hubzilla {
 -     if [ ! $ONION_ONLY ]; then
 -         ONION_ONLY='no'
 -     fi
 -     if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
 -         ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
 -         HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "HUBZILLA_CODE" $CONFIGURATION_FILE; then
 -         HUBZILLA_CODE=$(grep "HUBZILLA_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
 -         DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if [[ $ONION_ONLY != "no" ]]; then
 -         HUBZILLA_DOMAIN_NAME='hubzilla.local'
 -     else
 -         HUBZILLA_DETAILS_COMPLETE=
 -         while [ ! $HUBZILLA_DETAILS_COMPLETE ]
 -         do
 -             data=$(tempfile 2>/dev/null)
 -             trap "rm -f $data" 0 1 2 5 15
 -             if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
 -                 dialog --backtitle $"Freedombone Configuration" \
 -                        --title $"Hubzilla Configuration" \
 -                        --form $"\nPlease enter your Hubzilla details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 55 3 \
 -                        $"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
 -                        $"Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 255 \
 -                        2> $data
 -             else
 -                 dialog --backtitle $"Freedombone Configuration" \
 -                        --title $"Hubzilla Configuration" \
 -                        --form $"\nPlease enter your Hubzilla details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
 -                        $"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
 -                        2> $data
 -             fi
 -             sel=$?
 -             case $sel in
 -                 1) exit 1;;
 -                 255) exit 1;;
 -             esac
 -             HUBZILLA_DOMAIN_NAME=$(cat $data | sed -n 1p)
 -             if [ $HUBZILLA_DOMAIN_NAME ]; then
 -                 TEST_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME
 -                 validate_domain_name
 -                 if [[ $TEST_DOMAIN_NAME != $HUBZILLA_DOMAIN_NAME ]]; then
 -                     HUBZILLA_DOMAIN_NAME=
 -                     dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
 -                 else
 -                     if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
 -                         HUBZILLA_CODE=$(cat $data | sed -n 2p)
 -                         validate_freedns_code "$HUBZILLA_CODE"
 -                         if [ ! $VALID_CODE ]; then
 -                             HUBZILLA_DOMAIN_NAME=
 -                         fi
 -                     fi
 -                 fi
 -             fi
 -             if [ $HUBZILLA_DOMAIN_NAME ]; then
 -                 HUBZILLA_DETAILS_COMPLETE="yes"
 -             fi
 -         done
 -         # save the results in the config file
 -         if grep -q "HUBZILLA_DOMAIN_NAME=" $CONFIGURATION_FILE; then
 -             sed -i "s|HUBZILLA_DOMAIN_NAME=.*|HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME|g" $CONFIGURATION_FILE
 -         else
 -             echo "HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME" >> $CONFIGURATION_FILE
 -         fi
 -         if grep -q "HUBZILLA_CODE=" $CONFIGURATION_FILE; then
 -             sed -i "s|HUBZILLA_CODE=.*|HUBZILLA_CODE=$HUBZILLA_CODE|g" $CONFIGURATION_FILE
 -         else
 -             echo "HUBZILLA_CODE=$HUBZILLA_CODE" >> $CONFIGURATION_FILE
 -         fi
 -     fi
 - }
 - 
 - function change_password_hubzilla {
 -     echo -n ''
 - }
 - 
 - function get_mariadb_hubzilla_admin_password {
 -     if [ -f /home/$MY_USERNAME/README ]; then
 -         if grep -q "MariaDB Hubzilla admin password" /home/$MY_USERNAME/README; then
 -             HUBZILLA_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "MariaDB Hubzilla admin password" | awk -F ':' '{print $2}' | sed 's/^ *//')
 -         fi
 -     fi
 - }
 - 
 - function hubzilla_create_database {
 -     function_check get_mariadb_hubzilla_admin_password
 -     get_mariadb_hubzilla_admin_password
 -     if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then
 -         if [ -f $IMAGE_PASSWORD_FILE ]; then
 -             HUBZILLA_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
 -         else
 -             HUBZILLA_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
 -         fi
 -         echo '' >> /home/$MY_USERNAME/README
 -         echo '' >> /home/$MY_USERNAME/README
 -         echo 'Hubzilla' >> /home/$MY_USERNAME/README
 -         echo '========' >> /home/$MY_USERNAME/README
 -         if [[ $ONION_ONLY == 'no' ]]; then
 -             echo $"Open https://$HUBZILLA_DOMAIN_NAME and register a new user" >> /home/$MY_USERNAME/README
 -         else
 -             echo $"Open http://$HUBZILLA_ONION_HOSTNAME and register a new user" >> /home/$MY_USERNAME/README
 -         fi
 -         echo $"Your MariaDB Hubzilla admin password is: $HUBZILLA_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
 -         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
 -         chmod 600 /home/$MY_USERNAME/README
 -     fi
 -     if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then
 -         return
 -     fi
 - 
 -     function_check create_database
 -     create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD"
 - }
 - 
 - function reconfigure_hubzilla {
 -     echo -n ''
 - }
 - 
 - function upgrade_hubzilla {
 -     if ! grep -Fxq "install_hubzilla" $COMPLETION_FILE; then
 -         return
 -     fi
 -     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
 - 
 -     function_check set_repo_commit
 -     set_repo_commit $HUBZILLA_PATH "Hubzilla commit" "$HUBZILLA_COMMIT" $HUBZILLA_REPO
 -     set_repo_commit $HUBZILLA_PATH/addon "Hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT" $HUBZILLA_ADDONS_REPO
 -     if [ -d $HUBZILLA_PATH/redmatrix-themes1 ]; then
 -         cd $HUBZILLA_PATH/redmatrix-themes1
 -         git stash
 -         git pull
 -         cp -r $HUBZILLA_PATH/redmatrix-themes1/* $HUBZILLA_PATH/view/theme/
 -         chown -R www-data:www-data $HUBZILLA_PATH
 -     fi
 - }
 - 
 - function backup_local_hubzilla {
 -     if grep -q "Hubzilla domain" $COMPLETION_FILE; then
 -         HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -         hubzilla_path=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
 -         if [ -d $hubzilla_path ]; then
 -             echo $"Backing up Hubzilla"
 -             function_check backup_database_to_usb
 -             backup_database_to_usb hubzilla
 - 
 -             backup_directory_to_usb $hubzilla_path hubzilla
 - 
 -             echo $"Hubzilla backup complete"
 -         fi
 -     fi
 - }
 - 
 - function restore_local_hubzilla {
 -     if ! grep -q "Hubzilla domain" $COMPLETION_FILE; then
 -         return
 -     fi
 -     HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -     if [ $HUBZILLA_DOMAIN_NAME ]; then
 -         echo $"Restoring Hubzilla"
 -         temp_restore_dir=/root/temphubzilla
 -         hubzilla_dir=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
 - 
 -         function_check hubzilla_create_database
 -         hubzilla_create_database
 - 
 -         restore_database hubzilla ${HUBZILLA_DOMAIN_NAME}
 -         if [ -d $USB_MOUNT/backup/hubzilla ]; then
 -             if [ ! -d $hubzilla_dir/store/[data]/smarty3 ]; then
 -                 mkdir -p $hubzilla_dir/store/[data]/smarty3
 -             fi
 -             chmod 777 $hubzilla_dir/store/[data]/smarty3
 -             chown -R www-data:www-data $hubzilla_dir/*
 -             if [ -d $temp_restore_dir ]; then
 -                 rm -rf $temp_restore_dir
 -             fi
 -         fi
 -         echo $"Restore of Hubzilla complete"
 -     fi
 - }
 - 
 - function backup_remote_hubzilla {
 -     if grep -q "Hubzilla domain" $COMPLETION_FILE; then
 -         HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -         temp_backup_dir=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
 -         if [ -d $temp_backup_dir ]; then
 -             suspend_site ${HUBZILLA_DOMAIN_NAME}
 -             backup_database_to_friend hubzilla
 -             echo "Backing up Hubzilla installation"
 -             backup_directory_to_friend $temp_backup_dir hubzilla
 -             restart_site
 -             echo "Backup of Hubzilla complete"
 -         else
 -             echo $"Hubzilla domain specified but not found in /var/www/${HUBZILLA_DOMAIN_NAME}"
 -             exit 2578
 -         fi
 -     fi
 - }
 - 
 - function restore_remote_hubzilla {
 -     if grep -q "Hubzilla domain" $COMPLETION_FILE; then
 -         echo $"Restoring Hubzilla"
 -         HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -         function_check restore_database_from_friend
 - 
 -         function_check hubzilla_create_database
 -         hubzilla_create_database
 - 
 -         restore_database_from_friend hubzilla ${HUBZILLA_DOMAIN_NAME}
 -         if [ -d $SERVER_DIRECTORY/backup/hubzilla ]; then
 -             if [ ! -d /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs/store/[data]/smarty3 ]; then
 -                 mkdir -p /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs/store/[data]/smarty3
 -             fi
 -             chmod 777 /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs/store/[data]/smarty3
 -             chown -R www-data:www-data /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs/*
 -         fi
 -         if [ -d /root/temphubzilla ]; then
 -             rm -rf /root/temphubzilla
 -         fi
 -         echo $"Restore of Hubzilla complete"
 -     fi
 - }
 - 
 - function remove_hubzilla {
 -     if [[ $(app_is_installed hubzilla) == "0" ]]; then
 -         return
 -     fi
 -     echo $'Removing Hubzilla'
 -     HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
 -     nginx_dissite $HUBZILLA_DOMAIN_NAME
 -     if [ -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
 -         rm -rf /var/www/$HUBZILLA_DOMAIN_NAME
 -     fi
 -     if [ -f /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME ]; then
 -         rm /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -     fi
 -     function_check drop_database
 -     drop_database hubzilla
 -     function_check remove_onion_service
 -     remove_onion_service hubzilla ${HUBZILLA_ONION_PORT}
 -     sed -i '/install_hubzilla/d' $COMPLETION_FILE
 -     sed -i '/Hubzilla /d' $COMPLETION_FILE
 -     echo $'Hubzilla was removed'
 - }
 - 
 - function install_hubzilla {
 -     if [ ! $ONION_ONLY ]; then
 -         ONION_ONLY='no'
 -     fi
 -     if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
 -         ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
 -         HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "HUBZILLA_CODE" $CONFIGURATION_FILE; then
 -         HUBZILLA_CODE=$(grep "HUBZILLA_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 -     if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
 -         DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
 -     fi
 - 
 -     if [ ! $HUBZILLA_DOMAIN_NAME ]; then
 -         return
 -     fi
 - 
 -     if [[ $ONION_ONLY != "no" ]]; then
 -         return
 -     fi
 - 
 -     if [[ $(app_is_installed hubzilla) == "1" ]]; then
 -         return
 -     fi
 - 
 -     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
 - 
 -     function_check install_mariadb
 -     install_mariadb
 - 
 -     function_check get_mariadb_password
 -     get_mariadb_password
 - 
 -     function_check repair_databases_script
 -     repair_databases_script
 - 
 -     apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
 -     apt-get -y install php5-dev imagemagick php5-imagick
 -     apt-get -y install php5-memcached
 - 
 -     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
 -         mkdir /var/www/$HUBZILLA_DOMAIN_NAME
 -     fi
 -     if [ ! -d $HUBZILLA_PATH ]; then
 -         mkdir $HUBZILLA_PATH
 -     fi
 - 
 -     if [ ! -f $HUBZILLA_PATH/index.php ]; then
 -         cd $INSTALL_DIR
 -         function_check git_clone
 -         git_clone $HUBZILLA_REPO hubzilla
 -         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
 -         if ! grep -q "Hubzilla commit" $COMPLETION_FILE; then
 -             echo "Hubzilla commit:$HUBZILLA_COMMIT" >> $COMPLETION_FILE
 -         else
 -             sed -i "s/Hubzilla commit.*/Hubzilla commit:$HUBZILLA_COMMIT/g" $COMPLETION_FILE
 -         fi
 - 
 -         rm -rf $HUBZILLA_PATH
 -         mv hubzilla $HUBZILLA_PATH
 - 
 -         git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
 -         cd $HUBZILLA_PATH/addon
 -         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
 -         if ! grep -q "Hubzilla addons commit" $COMPLETION_FILE; then
 -             echo "Hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT" >> $COMPLETION_FILE
 -         else
 -             sed -i "s/Hubzilla addons commit.*/Hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT/g" $COMPLETION_FILE
 -         fi
 - 
 -         # some extra themes
 -         git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
 -         cp -r $HUBZILLA_PATH/redmatrix-themes1/* $HUBZILLA_PATH/view/theme/
 - 
 -         chown -R www-data:www-data $HUBZILLA_PATH
 -     fi
 - 
 -     HUBZILLA_ONION_HOSTNAME=
 -     if [[ $ONION_ONLY != "no" ]]; then
 -         HUBZILLA_ONION_HOSTNAME=$(add_onion_service hubzilla 80 ${HUBZILLA_ONION_PORT})
 -         echo "Hubzilla onion domain:${HUBZILLA_ONION_HOSTNAME}" >> $COMPLETION_FILE
 -     fi
 - 
 -     hubzilla_create_database
 - 
 -     if ! grep -q "$HUBZILLA_PATH" /etc/crontab; then
 -         echo "12,22,32,42,52 * *   *   *   root cd $HUBZILLA_PATH; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab
 -     fi
 - 
 -     function_check add_ddns_domain
 -     add_ddns_domain $HUBZILLA_DOMAIN_NAME
 - 
 -     if [[ $ONION_ONLY == "no" ]]; then
 -         function_check nginx_http_redirect
 -         nginx_http_redirect $HUBZILLA_DOMAIN_NAME
 -         echo 'server {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    root $HUBZILLA_PATH;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    server_name $HUBZILLA_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    error_log /var/log/nginx/${HUBZILLA_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    charset utf-8;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    access_log off;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         function_check nginx_limits
 -         nginx_limits $HUBZILLA_DOMAIN_NAME
 -         function_check nginx_ssl
 -         nginx_ssl $HUBZILLA_DOMAIN_NAME
 -         function_check nginx_disable_sniffing
 -         nginx_disable_sniffing $HUBZILLA_DOMAIN_NAME
 -         echo '    add_header Strict-Transport-Security max-age=15768000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location / {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        allow all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        expires 30d;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # block these file types' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        deny all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # or a unix socket' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        deny all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '      deny  all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -     else
 -         echo 'server {' > /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    listen 127.0.0.1:${HUBZILLA_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    root $HUBZILLA_PATH;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    server_name $HUBZILLA_ONION_HOSTNAME;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    error_log /var/log/nginx/${HUBZILLA_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    charset utf-8;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    access_log off;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         nginx_limits $HUBZILLA_DOMAIN_NAME
 -         nginx_disable_sniffing $HUBZILLA_DOMAIN_NAME
 -         echo '    add_header Strict-Transport-Security max-age=15768000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location / {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        allow all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        expires 30d;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # block these file types' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        deny all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # or a unix socket' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~ /\. {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '        deny all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '      deny  all;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '    }' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -         echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
 -     fi
 - 
 -     function_check configure_php
 -     configure_php
 - 
 -     function_check create_site_certificate
 -     create_site_certificate $HUBZILLA_DOMAIN_NAME 'yes'
 - 
 -     if [ ! -d $HUBZILLA_PATH/view/tpl/smarty3 ]; then
 -         mkdir $HUBZILLA_PATH/view/tpl/smarty3
 -     fi
 -     if [ ! -d "$HUBZILLA_PATH/store" ]; then
 -         mkdir "$HUBZILLA_PATH/store"
 -     fi
 -     if [ ! -d "$HUBZILLA_PATH/store/[data]" ]; then
 -         mkdir "$HUBZILLA_PATH/store/[data]"
 -     fi
 -     if [ ! -d "$HUBZILLA_PATH/store/[data]/smarty3" ]; then
 -         mkdir "$HUBZILLA_PATH/store/[data]/smarty3"
 -         chmod 777 "$HUBZILLA_PATH/store/[data]/smarty3"
 -     fi
 -     chmod 777 $HUBZILLA_PATH/view/tpl
 -     chown -R www-data:www-data "$HUBZILLA_PATH/store"
 -     chmod 777 $HUBZILLA_PATH/view/tpl/smarty3
 - 
 -     # Ensure that the database gets backed up locally, if remote
 -     # backups are not being used
 -     function_check backup_databases_script_header
 -     backup_databases_script_header
 - 
 -     function_check backup_database_local
 -     backup_database_local hubzilla
 - 
 -     chown -R www-data:www-data $HUBZILLA_PATH
 - 
 -     function_check nginx_ensite
 -     nginx_ensite $HUBZILLA_DOMAIN_NAME
 - 
 -     # initialize the database
 -     if [ ! -f $HUBZILLA_PATH/install/schema_mysql.sql ]; then
 -         echo $'No database schema found for hubzilla'
 -         exit 252782
 -     fi
 -     function_check initialise_database
 -     initialise_database hubzilla $HUBZILLA_PATH/install/schema_mysql.sql
 - 
 -     # create the config file
 -     echo '<?php' > $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_host = 'localhost';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_port = '0';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_user = 'root';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_pass = '${MARIADB_PASSWORD}';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_data = 'hubzilla';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$db_type = '0';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$default_timezone = 'Europe/London';" >> $HUBZILLA_PATH/.htconfig.php
 -     if [[ $ONION_ONLY == 'no' ]]; then
 -         echo "\$a->config['system']['baseurl'] = 'https://${HUBZILLA_DOMAIN_NAME}';" >> $HUBZILLA_PATH/.htconfig.php
 -     else
 -         echo "\$a->config['system']['baseurl'] = 'http://${HUBZILLA_ONION_HOSTNAME}';" >> $HUBZILLA_PATH/.htconfig.php
 -     fi
 -     echo "\$a->config['system']['sitename'] = \"Hubzilla\";" >> $HUBZILLA_PATH/.htconfig.php
 -     HUBZILLA_LOCATION_HASH="$(create_password 30)"
 -     echo "\$a->config['system']['location_hash'] = '${HUBZILLA_LOCATION_HASH}';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['register_policy'] = REGISTER_OPEN;" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['register_text'] = '';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['admin_email'] = '${MY_EMAIL_ADDRESS}';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['verify_email'] = 1;" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['access_policy'] = ACCESS_PRIVATE;" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['sellpage'] = '';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['max_import_size'] = 200000;" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['php_path'] = '/usr/bin/php';" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['directory_mode']  = DIRECTORY_MODE_NORMAL;" >> $HUBZILLA_PATH/.htconfig.php
 -     echo "\$a->config['system']['theme'] = 'redbasic';" >> $HUBZILLA_PATH/.htconfig.php
 -     chown www-data:www-data $HUBZILLA_PATH/.htconfig.php
 -     chmod 755 $HUBZILLA_PATH/.htconfig.php
 - 
 -     systemctl restart php5-fpm
 -     systemctl restart nginx
 -     systemctl restart cron
 - 
 -     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$HUBZILLA_DOMAIN_NAME" -g hubzilla --public no
 - 
 -     echo "Hubzilla domain:${HUBZILLA_DOMAIN_NAME}" >> $COMPLETION_FILE
 -     install_completed hubzilla
 - }
 - 
 - # NOTE: deliberately there is no "exit 0"
 
 
  |