From bdc79aa3da4531696b72895e4d4ed9f42c128977 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 10 Mar 2016 10:00:35 +0000 Subject: [PATCH] Keep hubzilla emails in a separate folder --- src/freedombone | 268 ++++++++++++++++++++++++------------------------ 1 file changed, 135 insertions(+), 133 deletions(-) diff --git a/src/freedombone b/src/freedombone index 656694b2..7b1fc79e 100755 --- a/src/freedombone +++ b/src/freedombone @@ -6230,152 +6230,152 @@ function create_public_mailing_list { echo ' # Virtual Host Configs' >> /etc/nginx/nginx.conf echo ' ##' >> /etc/nginx/nginx.conf echo '' >> /etc/nginx/nginx.conf - echo ' include /etc/nginx/conf.d/*.conf;' >> /etc/nginx/nginx.conf - echo ' include /etc/nginx/sites-enabled/*;' >> /etc/nginx/nginx.conf - echo '}' >> /etc/nginx/nginx.conf + echo ' include /etc/nginx/conf.d/*.conf;' >> /etc/nginx/nginx.conf + echo ' include /etc/nginx/sites-enabled/*;' >> /etc/nginx/nginx.conf + echo '}' >> /etc/nginx/nginx.conf - # install a script to easily enable and disable nginx virtual hosts - if [ ! -d $INSTALL_DIR ]; then - mkdir $INSTALL_DIR - fi - cd $INSTALL_DIR - git_clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite - cd $INSTALL_DIR/nginx_ensite - git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT - if ! grep -q "Nginx-ensite commit" $COMPLETION_FILE; then - echo "Nginx-ensite commit:$NGINX_ENSITE_COMMIT" >> $COMPLETION_FILE - else - sed -i "s/Nginx-ensite commit.*/Nginx-ensite commit:$NGINX_ENSITE_COMMIT/g" $COMPLETION_FILE - fi + # install a script to easily enable and disable nginx virtual hosts + if [ ! -d $INSTALL_DIR ]; then + mkdir $INSTALL_DIR + fi + cd $INSTALL_DIR + git_clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite + cd $INSTALL_DIR/nginx_ensite + git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT + if ! grep -q "Nginx-ensite commit" $COMPLETION_FILE; then + echo "Nginx-ensite commit:$NGINX_ENSITE_COMMIT" >> $COMPLETION_FILE + else + sed -i "s/Nginx-ensite commit.*/Nginx-ensite commit:$NGINX_ENSITE_COMMIT/g" $COMPLETION_FILE + fi - make install - nginx_dissite default - echo 'install_web_server' >> $COMPLETION_FILE -} + make install + nginx_dissite default + echo 'install_web_server' >> $COMPLETION_FILE + } -function install_web_server_access_control { - if [ ! -f /etc/pam.d/nginx ]; then - echo '#%PAM-1.0' > /etc/pam.d/nginx - echo '@include common-auth' >> /etc/pam.d/nginx - echo '@include common-account' >> /etc/pam.d/nginx - echo '@include common-session' >> /etc/pam.d/nginx - fi -} + function install_web_server_access_control { + if [ ! -f /etc/pam.d/nginx ]; then + echo '#%PAM-1.0' > /etc/pam.d/nginx + echo '@include common-auth' >> /etc/pam.d/nginx + echo '@include common-account' >> /etc/pam.d/nginx + echo '@include common-session' >> /etc/pam.d/nginx + fi + } -function configure_php { - sed -i "s/memory_limit = 128M/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php5/fpm/php.ini - sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini - sed -i "s/memory_limit = -1/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php5/cli/php.ini - sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/g" /etc/php5/fpm/php.ini - sed -i "s/post_max_size = 8M/post_max_size = 50M/g" /etc/php5/fpm/php.ini -} + function configure_php { + sed -i "s/memory_limit = 128M/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php5/fpm/php.ini + sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini + sed -i "s/memory_limit = -1/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php5/cli/php.ini + sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/g" /etc/php5/fpm/php.ini + sed -i "s/post_max_size = 8M/post_max_size = 50M/g" /etc/php5/fpm/php.ini + } -function install_mariadb { - if grep -Fxq "install_mariadb" $COMPLETION_FILE; then - return - fi - apt-get -y install python-software-properties debconf-utils - apt-get -y install software-properties-common - apt-get -y update + function install_mariadb { + if grep -Fxq "install_mariadb" $COMPLETION_FILE; then + return + fi + apt-get -y install python-software-properties debconf-utils + apt-get -y install software-properties-common + apt-get -y update - get_mariadb_password - if [ ! $MARIADB_PASSWORD ]; then - if [ -f $IMAGE_PASSWORD_FILE ]; then - MARIADB_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)" - else - MARIADB_PASSWORD="$(openssl rand -base64 32)" - fi - echo "$MARIADB_PASSWORD" > $DATABASE_PASSWORD_FILE - chmod 600 $DATABASE_PASSWORD_FILE + get_mariadb_password + if [ ! $MARIADB_PASSWORD ]; then + if [ -f $IMAGE_PASSWORD_FILE ]; then + MARIADB_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)" + else + MARIADB_PASSWORD="$(openssl rand -base64 32)" + fi + echo "$MARIADB_PASSWORD" > $DATABASE_PASSWORD_FILE + chmod 600 $DATABASE_PASSWORD_FILE - echo '' >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - echo 'MariaDB / MySql' >> /home/$MY_USERNAME/README - echo '===============' >> /home/$MY_USERNAME/README - echo $"Your MariaDB password is: $MARIADB_PASSWORD" >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README - chmod 600 /home/$MY_USERNAME/README - fi + echo '' >> /home/$MY_USERNAME/README + echo '' >> /home/$MY_USERNAME/README + echo 'MariaDB / MySql' >> /home/$MY_USERNAME/README + echo '===============' >> /home/$MY_USERNAME/README + echo $"Your MariaDB password is: $MARIADB_PASSWORD" >> /home/$MY_USERNAME/README + echo '' >> /home/$MY_USERNAME/README + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README + chmod 600 /home/$MY_USERNAME/README + fi - debconf-set-selections <<< "mariadb-server mariadb-server/root_password password $MARIADB_PASSWORD" - debconf-set-selections <<< "mariadb-server mariadb-server/root_password_again password $MARIADB_PASSWORD" - apt-get -y install mariadb-server - apt-get -y remove --purge apache* - if [ -d /etc/apache2 ]; then - rm -rf /etc/apache2 - echo $'Removed Apache installation after MariaDB install' - fi + debconf-set-selections <<< "mariadb-server mariadb-server/root_password password $MARIADB_PASSWORD" + debconf-set-selections <<< "mariadb-server mariadb-server/root_password_again password $MARIADB_PASSWORD" + apt-get -y install mariadb-server + apt-get -y remove --purge apache* + if [ -d /etc/apache2 ]; then + rm -rf /etc/apache2 + echo $'Removed Apache installation after MariaDB install' + fi - if [ ! -d /etc/mysql ]; then - echo $"ERROR: mariadb-server does not appear to have installed. $CHECK_MESSAGE" - exit 54 - fi + if [ ! -d /etc/mysql ]; then + echo $"ERROR: mariadb-server does not appear to have installed. $CHECK_MESSAGE" + exit 54 + fi - mysqladmin -u root password "$MARIADB_PASSWORD" - echo 'install_mariadb' >> $COMPLETION_FILE -} + mysqladmin -u root password "$MARIADB_PASSWORD" + echo 'install_mariadb' >> $COMPLETION_FILE + } -function backup_databases_script_header { - if [ ! -f /usr/bin/backupdatabases ]; then - # daily - echo '#!/bin/sh' > /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo "EMAIL='$MY_EMAIL_ADDRESS'" >> /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo -n 'MYSQL_PASSWORD=$(cat ' >> /usr/bin/backupdatabases - echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/backupdatabases - echo 'umask 0077' >> /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo '# exit if we are backing up to friends servers' >> /usr/bin/backupdatabases - echo "if [ -f $FRIENDS_SERVERS_LIST ]; then" >> /usr/bin/backupdatabases - echo ' exit 1' >> /usr/bin/backupdatabases - echo 'fi' >> /usr/bin/backupdatabases - chmod 600 /usr/bin/backupdatabases - chmod +x /usr/bin/backupdatabases + function backup_databases_script_header { + if [ ! -f /usr/bin/backupdatabases ]; then + # daily + echo '#!/bin/sh' > /usr/bin/backupdatabases + echo '' >> /usr/bin/backupdatabases + echo "EMAIL='$MY_EMAIL_ADDRESS'" >> /usr/bin/backupdatabases + echo '' >> /usr/bin/backupdatabases + echo -n 'MYSQL_PASSWORD=$(cat ' >> /usr/bin/backupdatabases + echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/backupdatabases + echo 'umask 0077' >> /usr/bin/backupdatabases + echo '' >> /usr/bin/backupdatabases + echo '# exit if we are backing up to friends servers' >> /usr/bin/backupdatabases + echo "if [ -f $FRIENDS_SERVERS_LIST ]; then" >> /usr/bin/backupdatabases + echo ' exit 1' >> /usr/bin/backupdatabases + echo 'fi' >> /usr/bin/backupdatabases + chmod 600 /usr/bin/backupdatabases + chmod +x /usr/bin/backupdatabases - echo '#!/bin/sh' > /etc/cron.daily/backupdatabasesdaily - echo '/usr/bin/backupdatabases' >> /etc/cron.daily/backupdatabasesdaily - chmod 600 /etc/cron.daily/backupdatabasesdaily - chmod +x /etc/cron.daily/backupdatabasesdaily + echo '#!/bin/sh' > /etc/cron.daily/backupdatabasesdaily + echo '/usr/bin/backupdatabases' >> /etc/cron.daily/backupdatabasesdaily + chmod 600 /etc/cron.daily/backupdatabasesdaily + chmod +x /etc/cron.daily/backupdatabasesdaily - # weekly - echo '#!/bin/sh' > /etc/cron.weekly/backupdatabasesweekly - echo '' >> /etc/cron.weekly/backupdatabasesweekly - echo 'umask 0077' >> /etc/cron.weekly/backupdatabasesweekly + # weekly + echo '#!/bin/sh' > /etc/cron.weekly/backupdatabasesweekly + echo '' >> /etc/cron.weekly/backupdatabasesweekly + echo 'umask 0077' >> /etc/cron.weekly/backupdatabasesweekly - chmod 600 /etc/cron.weekly/backupdatabasesweekly - chmod +x /etc/cron.weekly/backupdatabasesweekly + chmod 600 /etc/cron.weekly/backupdatabasesweekly + chmod +x /etc/cron.weekly/backupdatabasesweekly - # monthly - echo '#!/bin/sh' > /etc/cron.monthly/backupdatabasesmonthly - echo '' >> /etc/cron.monthly/backupdatabasesmonthly - echo 'umask 0077' >> /etc/cron.monthly/backupdatabasesmonthly + # monthly + echo '#!/bin/sh' > /etc/cron.monthly/backupdatabasesmonthly + echo '' >> /etc/cron.monthly/backupdatabasesmonthly + echo 'umask 0077' >> /etc/cron.monthly/backupdatabasesmonthly - chmod 600 /etc/cron.monthly/backupdatabasesmonthly - chmod +x /etc/cron.monthly/backupdatabasesmonthly - fi -} + chmod 600 /etc/cron.monthly/backupdatabasesmonthly + chmod +x /etc/cron.monthly/backupdatabasesmonthly + fi + } -function repair_databases_script { - if [ -f /etc/cron.hourly/repair ]; then - sed -i "s|/usr/bin/repairdatabase|${PROJECT_NAME}-repair-database|g" /etc/cron.hourly/repair - fi + function repair_databases_script { + if [ -f /etc/cron.hourly/repair ]; then + sed -i "s|/usr/bin/repairdatabase|${PROJECT_NAME}-repair-database|g" /etc/cron.hourly/repair + fi - if grep -Fxq "repair_databases_script" $COMPLETION_FILE; then - return - fi + if grep -Fxq "repair_databases_script" $COMPLETION_FILE; then + return + fi - if [ ! -f $DATABASE_PASSWORD_FILE ]; then - return - fi + if [ ! -f $DATABASE_PASSWORD_FILE ]; then + return + fi - echo '#!/bin/bash' > /etc/cron.hourly/repair - echo '' >> /etc/cron.hourly/repair - chmod 600 /etc/cron.hourly/repair - chmod +x /etc/cron.hourly/repair + echo '#!/bin/bash' > /etc/cron.hourly/repair + echo '' >> /etc/cron.hourly/repair + chmod 600 /etc/cron.hourly/repair + chmod +x /etc/cron.hourly/repair - echo 'repair_databases_script' >> $COMPLETION_FILE + echo 'repair_databases_script' >> $COMPLETION_FILE } function install_owncloud_music_app { @@ -9722,6 +9722,8 @@ function install_hubzilla { systemctl restart nginx systemctl restart cron + freedombone-addemail -u $MY_USERNAME -e "noreply@$HUBZILLA_DOMAIN_NAME" -g hubzilla --public no + echo "Hubzilla domain:${HUBZILLA_DOMAIN_NAME}" >> $COMPLETION_FILE echo 'install_hubzilla' >> $COMPLETION_FILE } @@ -9806,17 +9808,17 @@ function install_dlna_server { sed -i 's/#inotify=yes/inotify=yes/g' /etc/minidlna.conf sed -i 's/#notify_interval=895/notify_interval=300/g' /etc/minidlna.conf sed -i "s|#presentation_url=/|presentation_url=http://localhost:8200|g" /etc/minidlna.conf - service minidlna force-reload - service minidlna reload + service minidlna force-reload + service minidlna reload - sed -i 's/fs.inotify.max_user_watches*/fs.inotify.max_user_watches=65536/g' /etc/sysctl.conf - if ! grep -q "max_user_watches" $COMPLETION_FILE; then - echo 'fs.inotify.max_user_watches=65536' >> /etc/sysctl.conf - fi - /sbin/sysctl -p + sed -i 's/fs.inotify.max_user_watches*/fs.inotify.max_user_watches=65536/g' /etc/sysctl.conf + if ! grep -q "max_user_watches" $COMPLETION_FILE; then + echo 'fs.inotify.max_user_watches=65536' >> /etc/sysctl.conf + fi + /sbin/sysctl -p - echo 'install_dlna_server' >> $COMPLETION_FILE + echo 'install_dlna_server' >> $COMPLETION_FILE } function install_mediagoblin {