diff options
Diffstat (limited to '.homeinstall/hubzilla-setup.sh')
-rwxr-xr-x | .homeinstall/hubzilla-setup.sh | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/.homeinstall/hubzilla-setup.sh b/.homeinstall/hubzilla-setup.sh index 670844b83..01acb1ec9 100755 --- a/.homeinstall/hubzilla-setup.sh +++ b/.homeinstall/hubzilla-setup.sh @@ -224,6 +224,19 @@ function print_warn { echo -e '\e[0m' } +function stop_hubzilla { + if [ -d /etc/apache2 ] + then + print_info "stopping apache webserver..." + service apache2 stop + fi + if [ -f /etc/init.d/mysql ] + then + print_info "stopping mysql db..." + /etc/init.d/mysql stop + fi +} + function install_apache { print_info "installing apache..." nocheck_install "apache2 apache2-utils" @@ -236,7 +249,7 @@ function install_curl { function install_sendmail { print_info "installing sendmail..." - nocheck_install "sendmail" + nocheck_install "sendmail sendmail-bin" } function install_php { @@ -561,7 +574,8 @@ function install_hubzilla { chmod -R 777 store touch .htconfig.php chmod ou+w .htconfig.php - cd .. + install_hubzilla_plugins + cd /var/www/ chown -R www-data:www-data html chown root:www-data /var/www/html/ chown root:www-data /var/www/html/.htaccess @@ -575,6 +589,73 @@ function install_hubzilla { print_info "installed hubzilla" } +function install_hubzilla_plugins { + print_info "installing hubzilla plugins..." + cd /var/www/html + plugin_install=.homeinstall/plugin_install.txt + theme_install=.homeinstall/theme_install.txt + # overwrite script to update the plugin and themes + rm -f $plugins_update + echo "cd /var/www/html" >> $plugins_update + ################### + # write plugin file + if [ ! -f "$plugin_install" ] + then + echo "# To install a plugin" >> $plugin_install + echo "# 1. add the plugin in a new line and run" >> $plugin_install + echo "# 2. run" >> $plugin_install + echo "# cd /var/www/html/.homeinstall" >> $plugin_install + echo "# ./hubzilla-setup.sh" >> $plugin_install + echo "https://gitlab.com/zot/ownmapp.git ownMap" >> $plugin_install + echo "https://gitlab.com/zot/hubzilla-chess.git chess" >> $plugin_install + fi + # install plugins + while read -r line; do + [[ "$line" =~ ^#.*$ ]] && continue + p_url=$(echo $line | awk -F' ' '{print $1}') + p_name=$(echo $line | awk -F' ' '{print $2}') + # basic check of format + if [ ${#p_url} -ge 1 ] && [ ${#p_name} -ge 1 ] + then + # install addon + util/add_addon_repo $line + util/update_addon_repo $p_name # not sure if this line is neccessary + echo "util/update_addon_repo $p_name" >> $plugins_update + else + print_info "skipping installation of a plugin from file $plugin_install - something wrong with format in line: $line" + fi + done < "$plugin_install" + ################### + # write theme file + if [ ! -f "$theme_install" ] + then + echo "# To install a theme" >> $theme_install + echo "# 1. add the theme in a new line and run" >> $theme_install + echo "# 2. run" >> $theme_install + echo "# cd /var/www/html/.homeinstall" >> $theme_install + echo "# ./hubzilla-setup.sh" >> $theme_install + echo "https://github.com/DeadSuperHero/hubzilla-themes.git DeadSuperHeroThemes" >> $theme_install + + fi + # install plugins + while read -r line; do + [[ "$line" =~ ^#.*$ ]] && continue + p_url=$(echo $line | awk -F' ' '{print $1}') + p_name=$(echo $line | awk -F' ' '{print $2}') + # basic check of format + if [ ${#p_url} -ge 1 ] && [ ${#p_name} -ge 1 ] + then + # install addon + util/add_theme_repo $line + util/update_theme_repo $p_name # not sure if this line is neccessary + echo "util/update_theme_repo $p_name" >> $plugins_update + else + print_info "skipping installation of a theme from file $theme_install - something wrong with format in line: $line" + fi + done < "$theme_install" + print_info "installed hubzilla plugins and themes" +} + function rewrite_to_https { print_info "configuring apache to redirect http to httpS ..." htaccessfile=/var/www/html/.htaccess @@ -762,6 +843,7 @@ echo "echo \"\$(date) - updating hubhilla core...\"" >> /var/www/$hubzilladaily echo "git -C /var/www/html/ pull" >> /var/www/$hubzilladaily echo "echo \"\$(date) - updating hubhilla addons...\"" >> /var/www/$hubzilladaily echo "git -C /var/www/html/addon/ pull" >> /var/www/$hubzilladaily +echo "bash /var/www/html/$plugins_update" >> /var/www/$hubzilladaily echo "chown -R www-data:www-data /var/www/html/ # make all accessable for the webserver" >> /var/www/$hubzilladaily echo "chown root:www-data /var/www/html/.htaccess" >> /var/www/$hubzilladaily echo "chmod 0644 /var/www/html/.htaccess # www-data can read but not write it" >> /var/www/$hubzilladaily @@ -827,6 +909,7 @@ source $configfile selfhostdir=/etc/selfhost selfhostscript=selfhost-updater.sh hubzilladaily=hubzilla-daily.sh +plugins_update=.homeinstall/plugins_update.sh snapshotconfig=/etc/rsnapshot_hubzilla.conf snapshotconfig_external_device=/etc/rsnapshot_hubzilla_external_device.conf backup_mount_point=/media/hubzilla_backup @@ -836,6 +919,7 @@ sslconf=/etc/apache2/sites-available/default-ssl.conf #set -x # activate debugging from here check_config +stop_hubzilla update_upgrade install_curl install_sendmail |