diff --git a/src/freedombone b/src/freedombone index a6fb445c..2dddcabc 100755 --- a/src/freedombone +++ b/src/freedombone @@ -42,9 +42,6 @@ INSTALLING_ON_BBB="no" # Version number of this script VERSION="1.01" -# whether to enable hubzilla or redmatrix -ENABLE_HUBZILLA="yes" - # Different system variants which may be specified within # the SYSTEM_TYPE option VARIANT_FULL="full" @@ -150,13 +147,6 @@ MICROBLOG_CODE= MICROBLOG_REPO="git://gitorious.org/social/mainline.git" MICROBLOG_ADMIN_PASSWORD= -# Domain name for redmatrix installation -REDMATRIX_DOMAIN_NAME= -REDMATRIX_CODE= -REDMATRIX_REPO="https://github.com/redmatrix/redmatrix.git" -REDMATRIX_ADDONS_REPO="https://github.com/redmatrix/redmatrix-addons.git" -REDMATRIX_ADMIN_PASSWORD= - # Domain name for hubzilla installation HUBZILLA_DOMAIN_NAME= HUBZILLA_CODE= @@ -448,7 +438,6 @@ function show_help { echo ' --wikidomain Wiki domain name' echo ' --blogdomain Blog domain name' echo ' --ownclouddomain Owncloud domain name' - echo ' --redmatrixdomain Redmatrix domain name' echo ' --hubzilladomain Hubzilla domain name' echo ' --gitdomain Git hosting domain name' echo ' -t --time Domain used as a TLS time source' @@ -597,11 +586,6 @@ else shift OWNCLOUD_DOMAIN_NAME="$1" ;; - # redmatrix domain name - --redmatrixdomain) - shift - REDMATRIX_DOMAIN_NAME="$1" - ;; # hubzilla domain name --hubzilladomain) shift @@ -792,9 +776,6 @@ function read_configuration { fi if [ -f $CONFIGURATION_FILE ]; then - if grep -q "ENABLE_HUBZILLA" $CONFIGURATION_FILE; then - ENABLE_HUBZILLA=$(grep "ENABLE_HUBZILLA" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi if grep -q "TRACKER_PORT" $CONFIGURATION_FILE; then TRACKER_PORT=$(grep "TRACKER_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi @@ -992,12 +973,6 @@ function read_configuration { if grep -q "MICROBLOG_CODE" $CONFIGURATION_FILE; then MICROBLOG_CODE=$(grep "MICROBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi - if grep -q "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE; then - REDMATRIX_DOMAIN_NAME=$(grep "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - if grep -q "REDMATRIX_CODE" $CONFIGURATION_FILE; then - REDMATRIX_CODE=$(grep "REDMATRIX_CODE" $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 @@ -1084,16 +1059,9 @@ function check_domains { echo 'Wiki domain name is the same as microblog domain name. They must be different' exit 36827 fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - if [[ "$test_domain_name" == "$REDMATRIX_DOMAIN_NAME" ]]; then - echo 'Wiki domain name is the same as redmatrix domain name. They must be different' - exit 93637 - fi - else - if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then - echo 'Wiki domain name is the same as hubzilla domain name. They must be different' - exit 65848 - fi + if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then + echo 'Wiki domain name is the same as hubzilla domain name. They must be different' + exit 65848 fi fi @@ -1112,16 +1080,9 @@ function check_domains { echo 'Owncloud domain name is the same as microblog domain name. They must be different' exit 36896 fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - if [[ "$test_domain_name" == "$REDMATRIX_DOMAIN_NAME" ]]; then - echo 'Owncloud domain name is the same as redmatrix domain name. They must be different' - exit 79362 - fi - else - if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then - echo 'Owncloud domain name is the same as hubzilla domain name. They must be different' - exit 68365 - fi + if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then + echo 'Owncloud domain name is the same as hubzilla domain name. They must be different' + exit 68365 fi fi @@ -1140,16 +1101,9 @@ function check_domains { echo 'Blog domain name is the same as microblog domain name. They must be different' exit 38236 fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - if [[ "$test_domain_name" == "$REDMATRIX_DOMAIN_NAME" ]]; then - echo 'Blog domain name is the same as redmatrix domain name. They must be different' - exit 36813 - fi - else - if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then - echo 'Blog domain name is the same as hubzilla domain name. They must be different' - exit 35483 - fi + if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then + echo 'Blog domain name is the same as hubzilla domain name. They must be different' + exit 35483 fi fi @@ -1168,43 +1122,9 @@ function check_domains { echo 'Microblog domain name is the same as blog domain name. They must be different' exit 26832 fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - if [[ "$test_domain_name" == "$REDMATRIX_DOMAIN_NAME" ]]; then - echo 'Microblog domain name is the same as redmatrix domain name. They must be different' - exit 36373 - fi - else - if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then - echo 'Microblog domain name is the same as hubzilla domain name. They must be different' - exit 678382 - fi - fi - fi - - if [ $REDMATRIX_DOMAIN_NAME ]; then - test_domain_name "$REDMATRIX_DOMAIN_NAME" - - if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as wiki domain name. They must be different' - exit 83682 - fi - if [[ "$test_domain_name" == "$OWNCLOUD_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as Owncloud domain name. They must be different' - exit 65192 - fi - if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as blog domain name. They must be different' - exit 74817 - fi - if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as microblog domain name. They must be different' - exit 83683 - fi - if [[ $ENABLE_HUBZILLA != "no" ]]; then - if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as hubzilla domain name. They must be different' - exit 82672 - fi + if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then + echo 'Microblog domain name is the same as hubzilla domain name. They must be different' + exit 678382 fi fi @@ -1212,27 +1132,21 @@ function check_domains { test_domain_name "$HUBZILLA_DOMAIN_NAME" if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as wiki domain name. They must be different' + echo 'Hubzilla domain name is the same as wiki domain name. They must be different' exit 83682 fi if [[ "$test_domain_name" == "$OWNCLOUD_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as Owncloud domain name. They must be different' + echo 'Hubzilla domain name is the same as Owncloud domain name. They must be different' exit 65192 fi if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as blog domain name. They must be different' + echo 'Hubzilla domain name is the same as blog domain name. They must be different' exit 74817 fi if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as microblog domain name. They must be different' + echo 'Hubzilla domain name is the same as microblog domain name. They must be different' exit 83683 fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - if [[ "$test_domain_name" == "$REDMATRIX_DOMAIN_NAME" ]]; then - echo 'RedMatrix domain name is the same as redmatrix domain name. They must be different' - exit 82672 - fi - fi fi } @@ -2482,14 +2396,6 @@ function get_mariadb_git_admin_password { fi } -function get_mariadb_redmatrix_admin_password { - if [ -f /home/$MY_USERNAME/README ]; then - if grep -q "MariaDB Red Matrix admin password" /home/$MY_USERNAME/README; then - REDMATRIX_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "MariaDB Red Matrix admin password" | awk -F ':' '{print $2}' | sed 's/^ *//') - fi - fi -} - 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 @@ -2515,7 +2421,6 @@ function create_backup_script { get_mariadb_password get_mariadb_gnusocial_admin_password - get_mariadb_redmatrix_admin_password get_mariadb_hubzilla_admin_password get_mariadb_owncloud_admin_password get_mariadb_git_admin_password @@ -2628,47 +2533,6 @@ function create_backup_script { echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - BACKUP_INCLUDES_DATABASES="yes" - echo "if [ ! -d $USB_MOUNT/backup/redmatrix ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " mkdir -p $USB_MOUNT/backup/redmatrix" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "if [ ! -d $USB_MOUNT/backup/redmatrixdata ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " mkdir -p $USB_MOUNT/backup/redmatrixdata" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "if [ ! -d /root/tempredmatrixdata ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " mkdir -p /root/tempredmatrixdata" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'echo "Obtaining Red Matrix database backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'mysqldump --password=$DATABASE_PASSWORD redmatrix > /root/tempredmatrixdata/redmatrix.sql' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "if [ ! -s /root/tempredmatrixdata/redmatrix.sql ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' echo "Red Matrix database could not be saved"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " echo 'No MariaDB password was given'" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' shred -zu /root/tempredmatrixdata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 378' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/tempredmatrixdata $USB_MOUNT/backup/redmatrixdata $USB_MOUNT/backup/redmatrixdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 285' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/tempredmatrixdata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/tempredmatrixdata' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'echo "Backing up Red Matrix installation"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/www/$REDMATRIX_DOMAIN_NAME/htdocs $USB_MOUNT/backup/redmatrix $USB_MOUNT/backup/redmatrix.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 593' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME - fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then BACKUP_INCLUDES_DATABASES="yes" echo "if [ ! -d $USB_MOUNT/backup/hubzilla ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2680,10 +2544,10 @@ function create_backup_script { echo "if [ ! -d /root/temphubzilladata ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p /root/temphubzilladata" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'echo "Obtaining Red Matrix database backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo 'echo "Obtaining Hubzilla database backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'mysqldump --password=$DATABASE_PASSWORD hubzilla > /root/temphubzilladata/hubzilla.sql' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ ! -s /root/temphubzilladata/hubzilla.sql ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' echo "Red Matrix database could not be saved"' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo ' echo "Hubzilla database could not be saved"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo " echo 'No MariaDB password was given'" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " fi" >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2701,7 +2565,7 @@ function create_backup_script { echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'shred -zu /root/temphubzilladata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'rm -rf /root/temphubzilladata' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'echo "Backing up Red Matrix installation"' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo 'echo "Backing up Hubzilla installation"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "rsyncrypto -v -r /var/www/$HUBZILLA_DOMAIN_NAME/htdocs $USB_MOUNT/backup/hubzilla $USB_MOUNT/backup/hubzilla.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -3216,7 +3080,6 @@ function create_restore_script { get_mariadb_password get_mariadb_gnusocial_admin_password - get_mariadb_redmatrix_admin_password get_mariadb_hubzilla_admin_password get_mariadb_owncloud_admin_password get_mariadb_git_admin_password @@ -3583,66 +3446,16 @@ function create_restore_script { echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME fi - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - BACKUP_INCLUDES_WEBSITES="yes" - echo "if [ -d $USB_MOUNT/backup/redmatrix ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Restoring Red Matrix database"' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! -d /root/tempredmatrixdata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' mkdir /root/tempredmatrixdata' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rsyncrypto -v -d -r $USB_MOUNT/backup/redmatrixdata /root/tempredmatrixdata $USB_MOUNT/backup/redmatrixdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! -f /root/tempredmatrixdata/usb/backup/redmatrixdata/tempredmatrixdata/redmatrix.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Unable to restore Red Matrix database"' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' exit 504' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' mysqlsuccess=$(mysql -u root --password=$DATABASE_PASSWORD redmatrix -o < /root/tempredmatrixdata/usb/backup/redmatrixdata/tempredmatrixdata/redmatrix.sql)' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "$mysqlsuccess"' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' exit 965' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' shred -zu /root/tempredmatrixdata/usb/backup/redmatrixdata/tempredmatrixdata/*' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Restoring Red Matrix installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! -d /root/tempredmatrix ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' mkdir /root/tempredmatrix' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rsyncrypto -v -d -r $USB_MOUNT/backup/redmatrix /root/tempredmatrix $USB_MOUNT/backup/redmatrix.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rm -rf /var/www/$REDMATRIX_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " cp -r /root/tempredmatrix/usb/backup/redmatrix/www/$REDMATRIX_DOMAIN_NAME/htdocs/* /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' else' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " mv /root/tempredmatrix/usb/backup/redmatrix/www/$REDMATRIX_DOMAIN_NAME/htdocs /var/www/$REDMATRIX_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' exit 759' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrix' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' # Ensure that the bundled SSL cert is being used' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " if [ -f /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.bundle.crt ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " sed -i 's|$REDMATRIX_DOMAIN_NAME.crt|$REDMATRIX_DOMAIN_NAME.bundle.crt|g' /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " chmod 777 /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo " chown -R www-data:www-data /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/*" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME - fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then BACKUP_INCLUDES_WEBSITES="yes" echo "if [ -d $USB_MOUNT/backup/hubzilla ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Restoring Red Matrix database"' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' echo "Restoring Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /root/temphubzilladata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rsyncrypto -v -d -r $USB_MOUNT/backup/hubzilladata /root/temphubzilladata $USB_MOUNT/backup/hubzilladata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/hubzilla.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Unable to restore Red Matrix database"' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' echo "Unable to restore Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME @@ -3657,7 +3470,7 @@ function create_restore_script { echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' shred -zu /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/*' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' echo "Restoring Red Matrix installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' echo "Restoring Hubzilla installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /root/temphubzilla ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /root/temphubzilla' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME @@ -4023,12 +3836,6 @@ function create_freedns_updater { echo "$FREEDNS_WGET$FULLBLOG_CODE=" >> /usr/bin/dynamicdns fi fi - if [ $REDMATRIX_CODE ]; then - if [[ $REDMATRIX_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then - echo "# $REDMATRIX_DOMAIN_NAME" >> /usr/bin/dynamicdns - echo "$FREEDNS_WGET$REDMATRIX_CODE=" >> /usr/bin/dynamicdns - fi - fi if [ $HUBZILLA_CODE ]; then if [[ $HUBZILLA_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then echo "# $HUBZILLA_DOMAIN_NAME" >> /usr/bin/dynamicdns @@ -4083,7 +3890,6 @@ function backup_to_friends_servers { get_mariadb_password get_mariadb_gnusocial_admin_password - get_mariadb_redmatrix_admin_password get_mariadb_hubzilla_admin_password get_mariadb_owncloud_admin_password get_mariadb_git_admin_password @@ -4191,53 +3997,6 @@ function backup_to_friends_servers { echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - BACKUP_INCLUDES_DATABASES="yes" - echo 'if [ ! -d $SERVER_DIRECTORY/backup/redmatrix ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' mkdir -p $SERVER_DIRECTORY/backup/redmatrix' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'if [ ! -d $SERVER_DIRECTORY/backup/redmatrixdata ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' mkdir -p $SERVER_DIRECTORY/backup/redmatrixdata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -d /root/tempredmatrixdata ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " mkdir -p /root/tempredmatrixdata" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'echo "Obtaining Red Matrix database backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'mysqldump --password=$DATABASE_PASSWORD redmatrix > /root/tempredmatrixdata/redmatrix.sql' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -s /root/tempredmatrixdata/redmatrix.sql ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' echo "Red Matrix database could not be saved"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " echo 'No MariaDB password was given'" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " fi" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n ' echo "Unable to export redmatrix database" | mail -s "Freedombone backup to friends" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' exit 378' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "fi" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n 'rsyncrypto -v -r /root/tempredmatrixdata $SERVER_DIRECTORY/backup/redmatrixdata $SERVER_DIRECTORY/backup/redmatrixdata.keys ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' shred -zu /root/tempredmatrixdata/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n ' echo "Unable to encrypt redmatrix database" | mail -s "Freedombone backup to friends" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' exit 285' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'shred -zu /root/tempredmatrixdata/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'rm -rf /root/tempredmatrixdata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'echo "Backing up Red Matrix installation"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n "rsyncrypto -v -r /var/www/$REDMATRIX_DOMAIN_NAME/htdocs " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n '$SERVER_DIRECTORY/backup/redmatrix $SERVER_DIRECTORY/backup/redmatrix.keys ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n ' echo "Unable to encrypt redmatrix installation" | mail -s "Freedombone backup to friends" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' exit 593' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then BACKUP_INCLUDES_DATABASES="yes" echo 'if [ ! -d $SERVER_DIRECTORY/backup/hubzilla ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4249,10 +4008,10 @@ function backup_to_friends_servers { echo "if [ ! -d /root/temphubzilladata ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo " mkdir -p /root/temphubzilladata" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'echo "Obtaining Red Matrix database backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'echo "Obtaining Hubzilla database backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'mysqldump --password=$DATABASE_PASSWORD hubzilla > /root/temphubzilladata/hubzilla.sql' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "if [ ! -s /root/temphubzilladata/hubzilla.sql ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' echo "Red Matrix database could not be saved"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' echo "Hubzilla database could not be saved"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo " echo 'No MariaDB password was given'" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo " fi" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4273,7 +4032,7 @@ function backup_to_friends_servers { echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'shred -zu /root/temphubzilladata/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'rm -rf /root/temphubzilladata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'echo "Backing up Red Matrix installation"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'echo "Backing up Hubzilla installation"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n "rsyncrypto -v -r /var/www/$HUBZILLA_DOMAIN_NAME/htdocs " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n '$SERVER_DIRECTORY/backup/hubzilla $SERVER_DIRECTORY/backup/hubzilla.keys ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "$BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4943,7 +4702,6 @@ function restore_from_friend { get_mariadb_password get_mariadb_gnusocial_admin_password - get_mariadb_redmatrix_admin_password get_mariadb_hubzilla_admin_password get_mariadb_owncloud_admin_password get_mariadb_git_admin_password @@ -5283,63 +5041,17 @@ function restore_from_friend { echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME fi - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - BACKUP_INCLUDES_WEBSITES="yes" - echo 'if [ -d $SERVER_DIRECTORY/backup/redmatrix ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Restoring Red Matrix database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! -d /root/tempredmatrixdata ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' mkdir /root/tempredmatrixdata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo -n ' rsyncrypto -v -d -r $SERVER_DIRECTORY/backup/redmatrixdata /root/tempredmatrixdata $SERVER_DIRECTORY/backup/redmatrixdata.keys ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo "$BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! -f /root/tempredmatrixdata/remoterestore/backup/redmatrixdata/tempredmatrixdata/redmatrix.sql ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Unable to restore Red Matrix database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' exit 504' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' mysqlsuccess=$(mysql -u root --password=$DATABASE_PASSWORD redmatrix -o < /root/tempredmatrixdata/remoterestore/backup/redmatrixdata/tempredmatrixdata/redmatrix.sql)' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "$mysqlsuccess"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' exit 965' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' shred -zu /root/tempredmatrixdata/remoterestore/backup/redmatrixdata/tempredmatrixdata/*' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrixdata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Restoring Red Matrix installation"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! -d /root/tempredmatrix ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' mkdir /root/tempredmatrix' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo -n ' rsyncrypto -v -d -r $SERVER_DIRECTORY/backup/redmatrix /root/tempredmatrix $SERVER_DIRECTORY/backup/redmatrix.keys ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo "$BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " rm -rf /var/www/$REDMATRIX_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " cp -r /root/tempredmatrix/remoterestore/backup/redmatrix/www/$REDMATRIX_DOMAIN_NAME/htdocs/* /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' else' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " mv /root/tempredmatrix/remoterestore/backup/redmatrix/www/$REDMATRIX_DOMAIN_NAME/htdocs /var/www/$REDMATRIX_DOMAIN_NAME/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' exit 759' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' rm -rf /root/tempredmatrix' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' # Ensure that the bundled SSL cert is being used' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " if [ -f /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.bundle.crt ]; then" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " sed -i 's|$REDMATRIX_DOMAIN_NAME.crt|$REDMATRIX_DOMAIN_NAME.bundle.crt|g' /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " chmod 777 /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo " chown -R www-data:www-data /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/*" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then BACKUP_INCLUDES_WEBSITES="yes" echo 'if [ -d $SERVER_DIRECTORY/backup/hubzilla ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Restoring Red Matrix database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME + echo ' echo "Restoring Hubzilla database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' if [ ! -d /root/temphubzilladata ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' mkdir /root/temphubzilladata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo -n ' rsyncrypto -v -d -r $SERVER_DIRECTORY/backup/hubzilladata /root/temphubzilladata $SERVER_DIRECTORY/backup/hubzilladata.keys ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo "$BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' if [ ! -f /root/temphubzilladata/remoterestore/backup/hubzilladata/temphubzilladata/hubzilla.sql ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Unable to restore Red Matrix database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME + echo ' echo "Unable to restore Hubzilla database"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' exit 504' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME @@ -5350,7 +5062,7 @@ function restore_from_friend { echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' shred -zu /root/temphubzilladata/remoterestore/backup/hubzilladata/temphubzilladata/*' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME - echo ' echo "Restoring Red Matrix installation"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME + echo ' echo "Restoring Hubzilla installation"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' if [ ! -d /root/temphubzilla ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' mkdir /root/temphubzilla' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME @@ -9881,275 +9593,6 @@ quit" > $INSTALL_DIR/batch.sql echo 'install_gnu_social' >> $COMPLETION_FILE } -function install_redmatrix { - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - return - fi - if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then - return - fi - if [ ! $REDMATRIX_DOMAIN_NAME ]; then - return - fi - if [[ $ENABLE_HUBZILLA != "no" ]]; then - return - fi - - install_mariadb - get_mariadb_password - repair_databases_script - - apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git - - if [ ! -d /var/www/$REDMATRIX_DOMAIN_NAME ]; then - mkdir /var/www/$REDMATRIX_DOMAIN_NAME - fi - if [ ! -d /var/www/$REDMATRIX_DOMAIN_NAME/htdocs ]; then - mkdir /var/www/$REDMATRIX_DOMAIN_NAME/htdocs - fi - - if [ ! -f /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/index.php ]; then - cd $INSTALL_DIR - git clone $REDMATRIX_REPO redmatrix - - rm -rf /var/www/$REDMATRIX_DOMAIN_NAME/htdocs - mv redmatrix /var/www/$REDMATRIX_DOMAIN_NAME/htdocs - chown -R www-data:www-data /var/www/$REDMATRIX_DOMAIN_NAME/htdocs - git clone $REDMATRIX_ADDONS_REPO /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/addon - # some extra themes - git clone https://github.com/DeadSuperHero/redmatrix-themes /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/redmatrix-themes1 - cp -r /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/redmatrix-themes1/* view/theme/ - fi - - get_mariadb_redmatrix_admin_password - if [ ! $REDMATRIX_ADMIN_PASSWORD ]; then - REDMATRIX_ADMIN_PASSWORD="$(openssl rand -base64 32)" - echo '' >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - echo 'Red Matrix' >> /home/$MY_USERNAME/README - echo '==========' >> /home/$MY_USERNAME/README - echo "Your MariaDB Red Matrix admin password is: $REDMATRIX_ADMIN_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 "create database redmatrix; -CREATE USER 'redmatrixadmin'@'localhost' IDENTIFIED BY '$REDMATRIX_ADMIN_PASSWORD'; -GRANT ALL PRIVILEGES ON redmatrix.* TO 'redmatrixadmin'@'localhost'; -quit" > $INSTALL_DIR/batch.sql - chmod 600 $INSTALL_DIR/batch.sql - mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql - shred -zu $INSTALL_DIR/batch.sql - - if ! grep -q "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs" /etc/crontab; then - echo "12,22,32,42,52 * * * * root cd /var/www/$REDMATRIX_DOMAIN_NAME/htdocs; /usr/bin/timeout 240 /usr/bin/php include/poller.php" >> /etc/crontab - fi - - # update the dynamic DNS - CURRENT_DDNS_DOMAIN=$REDMATRIX_DOMAIN_NAME - add_ddns_domain - - echo 'server {' > /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' listen 80;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " server_name $REDMATRIX_DOMAIN_NAME;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " root /var/www/$REDMATRIX_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' access_log off;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " error_log /var/log/nginx/$REDMATRIX_DOMAIN_NAME_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' limit_conn conn_limit_per_ip 10;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' limit_req zone=req_limit_per_ip burst=10 nodelay;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' index index.php;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' rewrite ^ https://$server_name$request_uri? permanent;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '}' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo 'server {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " root /var/www/$REDMATRIX_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " server_name $REDMATRIX_DOMAIN_NAME;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " error_log /var/log/nginx/$REDMATRIX_DOMAIN_NAME_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' index index.php;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' charset utf-8;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' client_max_body_size 20m;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' client_body_buffer_size 128k;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' access_log off;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' limit_conn conn_limit_per_ip 10;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' limit_req zone=req_limit_per_ip burst=10 nodelay;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' ssl on;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " ssl_certificate /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.crt;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " ssl_certificate_key /etc/ssl/private/$REDMATRIX_DOMAIN_NAME.key;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " ssl_dhparam /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.dhparam;" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' ssl_session_timeout 5m;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' ssl_prefer_server_ciphers on;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' ssl_session_cache builtin:1000 shared:SSL:10m;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " ssl_protocols $SSL_PROTOCOLS; # not possible to do exclusive" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " ssl_ciphers '$SSL_CIPHERS';" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' add_header X-Frame-Options DENY;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' add_header X-Content-Type-Options nosniff;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' add_header Strict-Transport-Security max-age=15768000;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location / {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' allow all;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' expires 30d;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # block these file types' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' deny all;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # or a unix socket' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ~ /\. {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' deny all;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' deny all;' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo ' }' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - echo '}' >> /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME - - configure_php - - if [ ! -f /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.dhparam ]; then - freedombone-addcert -h $REDMATRIX_DOMAIN_NAME --dhkey $DH_KEYLENGTH - check_certificates $REDMATRIX_DOMAIN_NAME - fi - - if [ ! -d /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/view/tpl/smarty3 ]; then - mkdir /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/view/tpl/smarty3 - fi - if [ ! -d "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store" ]; then - mkdir "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store" - fi - if [ ! -d "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]" ]; then - mkdir "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]" - fi - if [ ! -d "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]/smarty3" ]; then - mkdir "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]/smarty3" - chmod 777 "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store/[data]/smarty3" - fi - chmod 777 /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/view/tpl - chown -R www-data:www-data "/var/www/$REDMATRIX_DOMAIN_NAME/htdocs/store" - chmod 777 /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/view/tpl/smarty3 - - # Ensure that the database gets backed up locally, if remote - # backups are not being used - backup_databases_script_header - echo '' >> /usr/bin/backupdatabases - echo '# Backup the Red Matrix database' >> /usr/bin/backupdatabases - echo 'TEMPFILE=/root/redmatrix.sql' >> /usr/bin/backupdatabases - echo 'DAILYFILE=/var/backups/redmatrix_daily.sql' >> /usr/bin/backupdatabases - echo 'mysqldump --password="$MYSQL_PASSWORD" redmatrix > $TEMPFILE' >> /usr/bin/backupdatabases - echo 'FILESIZE=$(stat -c%s $TEMPFILE)' >> /usr/bin/backupdatabases - echo 'if [ "$FILESIZE" -lt "1024" ]; then' >> /usr/bin/backupdatabases - echo ' if [ -f $DAILYFILE ]; then' >> /usr/bin/backupdatabases - echo ' cp $DAILYFILE $TEMPFILE' >> /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo ' # try to restore yesterdays database' >> /usr/bin/backupdatabases - echo ' mysql -u root --password="$MYSQL_PASSWORD" redmatrix -o < $DAILYFILE' >> /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo ' # Send a warning email' >> /usr/bin/backupdatabases - echo ' echo "Unable to create a backup of the Red Matrix database. Attempted to restore from yesterdays backup" | mail -s "Red Matrix backup" $EMAIL' >> /usr/bin/backupdatabases - echo ' else' >> /usr/bin/backupdatabases - echo ' # Send a warning email' >> /usr/bin/backupdatabases - echo ' echo "Unable to create a backup of the Red Matrix database." | mail -s "Red Matrix backup" $EMAIL' >> /usr/bin/backupdatabases - echo ' fi' >> /usr/bin/backupdatabases - echo 'else' >> /usr/bin/backupdatabases - echo ' chmod 600 $TEMPFILE' >> /usr/bin/backupdatabases - echo ' mv $TEMPFILE $DAILYFILE' >> /usr/bin/backupdatabases - echo '' >> /usr/bin/backupdatabases - echo ' # Make the backup readable only by root' >> /usr/bin/backupdatabases - echo ' chmod 600 $DAILYFILE' >> /usr/bin/backupdatabases - echo 'fi' >> /usr/bin/backupdatabases - - echo '' >> /etc/cron.weekly/backupdatabasesweekly - echo '# Red Matrix' >> /etc/cron.weekly/backupdatabasesweekly - echo 'if [ -f /var/backups/redmatrix_weekly.sql ]; then' >> /etc/cron.weekly/backupdatabasesweekly - echo ' cp -f /var/backups/redmatrix_weekly.sql /var/backups/redmatrix_2weekly.sql' >> /etc/cron.weekly/backupdatabasesweekly - echo 'fi' >> /etc/cron.weekly/backupdatabasesweekly - echo 'if [ -f /var/backups/redmatrix_daily.sql ]; then' >> /etc/cron.weekly/backupdatabasesweekly - echo ' cp -f /var/backups/redmatrix_daily.sql /var/backups/redmatrix_weekly.sql' >> /etc/cron.weekly/backupdatabasesweekly - echo 'fi' >> /etc/cron.weekly/backupdatabasesweekly - - echo '' >> /etc/cron.monthly/backupdatabasesmonthly - echo '# Red Matrix' >> /etc/cron.monthly/backupdatabasesmonthly - echo 'if [ -f /var/backups/redmatrix_monthly.sql ]; then' >> /etc/cron.monthly/backupdatabasesmonthly - echo ' cp -f /var/backups/redmatrix_monthly.sql /var/backups/redmatrix_2monthly.sql' >> /etc/cron.monthly/backupdatabasesmonthly - echo 'fi' >> /etc/cron.monthly/backupdatabasesmonthly - echo 'if [ -f /var/backups/redmatrix_weekly.sql ]; then' >> /etc/cron.monthly/backupdatabasesmonthly - echo ' cp -f /var/backups/redmatrix_weekly.sql /var/backups/redmatrix_monthly.sql' >> /etc/cron.monthly/backupdatabasesmonthly - echo 'fi' >> /etc/cron.monthly/backupdatabasesmonthly - - echo '/usr/bin/repairdatabase redmatrix' >> /etc/cron.hourly/repair - - nginx_ensite $REDMATRIX_DOMAIN_NAME - service php5-fpm restart - service nginx restart - service cron restart - - # some post-install instructions for the user - if ! grep -q "To set up your Red Matrix" /home/$MY_USERNAME/README; then - echo '' >> /home/$MY_USERNAME/README - echo "To set up your Red Matrix site go to" >> /home/$MY_USERNAME/README - echo "https://$REDMATRIX_DOMAIN_NAME" >> /home/$MY_USERNAME/README - echo 'You will need to have a non self-signed SSL certificate in order' >> /home/$MY_USERNAME/README - echo "to use Red Matrix. Put the public certificate in /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.crt" >> /home/$MY_USERNAME/README - echo "and the private certificate in /etc/ssl/private/$REDMATRIX_DOMAIN_NAME.key." >> /home/$MY_USERNAME/README - echo 'If there is an intermediate certificate needed (such as with StartSSL) then' >> /home/$MY_USERNAME/README - echo 'this will need to be concatenated onto the end of the crt file, like this:' >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - echo " cat /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.crt /etc/ssl/chains/startssl-sub.class1.server.ca.pem > /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.bundle.crt" >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - echo "Then change ssl_certificate to /etc/ssl/certs/$REDMATRIX_DOMAIN_NAME.bundle.crt" >> /home/$MY_USERNAME/README - echo "within /etc/nginx/sites-available/$REDMATRIX_DOMAIN_NAME" >> /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 'install_redmatrix' >> $COMPLETION_FILE -} - function install_hubzilla { if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then return @@ -10160,9 +9603,6 @@ function install_hubzilla { if [ ! $HUBZILLA_DOMAIN_NAME ]; then return fi - if [[ $ENABLE_HUBZILLA == "no" ]]; then - return - fi install_mariadb get_mariadb_password @@ -10689,19 +10129,6 @@ function create_upgrade_script { echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo 'apt-get -y update' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo 'apt-get -y upgrade' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - if grep -Fxq "install_redmatrix" $COMPLETION_FILE; then - echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo '# Red Matrix' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo "cd /var/www/$REDMATRIX_DOMAIN_NAME/htdocs" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo "cd /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/addon" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo "chown -R www-data:www-data /var/www/$REDMATRIX_DOMAIN_NAME/htdocs" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo '# Hubzilla' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME @@ -11288,7 +10715,6 @@ install_voip install_wiki install_blog install_gnu_social -install_redmatrix install_hubzilla install_dlna_server configure_firewall_for_dlna diff --git a/src/freedombone-config b/src/freedombone-config index 803337b8..7a36aa29 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -31,9 +31,6 @@ NO_OF_ARGS=$# -# whether to enable hubzilla or redmatrix -ENABLE_HUBZILLA="yes" - # Web site FREEDOMBONE_WEBSITE="http://freedombone.uk.to" @@ -83,8 +80,6 @@ FULLBLOG_DOMAIN_NAME= FULLBLOG_CODE= OWNCLOUD_DOMAIN_NAME= OWNCLOUD_CODE= -REDMATRIX_DOMAIN_NAME= -REDMATRIX_CODE= HUBZILLA_DOMAIN_NAME= HUBZILLA_CODE= MICROBLOG_DOMAIN_NAME= @@ -212,12 +207,6 @@ function save_configuration_file { if [ $OWNCLOUD_CODE ]; then echo "OWNCLOUD_CODE=$OWNCLOUD_CODE" >> $CONFIGURATION_FILE fi - if [ $REDMATRIX_DOMAIN_NAME ]; then - echo "REDMATRIX_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME" >> $CONFIGURATION_FILE - fi - if [ $REDMATRIX_CODE ]; then - echo "REDMATRIX_CODE=$REDMATRIX_CODE" >> $CONFIGURATION_FILE - fi if [ $HUBZILLA_DOMAIN_NAME ]; then echo "HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME" >> $CONFIGURATION_FILE fi @@ -260,9 +249,6 @@ function save_configuration_file { if [ $DH_KEYLENGTH ]; then echo "DH_KEYLENGTH=$DH_KEYLENGTH" >> $CONFIGURATION_FILE fi - if [ $ENABLE_HUBZILLA ]; then - echo "ENABLE_HUBZILLA=$ENABLE_HUBZILLA" >> $CONFIGURATION_FILE - fi } # test a domain name to see if it's valid @@ -1237,101 +1223,51 @@ function interactive_configuration { fi if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - if [[ $ENABLE_HUBZILLA == "no" ]]; then - REDMATRIX_DETAILS_COMPLETE= - while [ ! $REDMATRIX_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 "RedMatrix Configuration" \ - --form "\nPlease enter your RedMatrix details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'REDMATRIX_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - "Code:" 2 1 "$(grep 'REDMATRIX_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ - 2> $data + 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:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "Hubzilla Configuration" \ + --form "\nPlease enter your Hubzilla details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + 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 - dialog --backtitle "Freedombone Configuration" \ - --title "RedMatrix Configuration" \ - --form "\nPlease enter your RedMatrix details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'REDMATRIX_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - 2> $data - fi - sel=$? - case $sel in - 1) exit 1;; - 255) exit 1;; - esac - REDMATRIX_DOMAIN_NAME=$(cat $data | sed -n 1p) - if [ $REDMATRIX_DOMAIN_NAME ]; then - TEST_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME - validate_domain_name - if [[ $TEST_DOMAIN_NAME != $REDMATRIX_DOMAIN_NAME ]]; then - REDMATRIX_DOMAIN_NAME= - dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 - else - if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then - REDMATRIX_CODE=$(cat $data | sed -n 2p) - if [ ${#REDMATRIX_CODE} -lt 30 ]; then - REDMATRIX_DOMAIN_NAME= - dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 - fi + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + HUBZILLA_CODE=$(cat $data | sed -n 2p) + if [ ${#HUBZILLA_CODE} -lt 30 ]; then + HUBZILLA_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 fi fi fi - if [ $REDMATRIX_DOMAIN_NAME ]; then - REDMATRIX_DETAILS_COMPLETE="yes" - fi - done - - 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:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - "Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ - 2> $data - else - dialog --backtitle "Freedombone Configuration" \ - --title "Hubzilla Configuration" \ - --form "\nPlease enter your Hubzilla details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - 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) - if [ ${#HUBZILLA_CODE} -lt 30 ]; then - HUBZILLA_DOMAIN_NAME= - dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 - fi - fi - fi - fi - if [ $HUBZILLA_DOMAIN_NAME ]; then - HUBZILLA_DETAILS_COMPLETE="yes" - fi - done - fi + fi + if [ $HUBZILLA_DOMAIN_NAME ]; then + HUBZILLA_DETAILS_COMPLETE="yes" + fi + done save_configuration_file fi @@ -1362,9 +1298,6 @@ function interactive_configuration { esac MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p) if [ $MICROBLOG_DOMAIN_NAME ]; then - if [[ $MICROBLOG_DOMAIN_NAME == "$REDMATRIX_DOMAIN_NAME" ]]; then - MICROBLOG_DOMAIN_NAME="" - fi if [[ $MICROBLOG_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then MICROBLOG_DOMAIN_NAME="" fi @@ -1539,9 +1472,6 @@ function read_configuration { fi if [ -f $CONFIGURATION_FILE ]; then - if grep -q "ENABLE_HUBZILLA" $CONFIGURATION_FILE; then - ENABLE_HUBZILLA=$(grep "ENABLE_HUBZILLA" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi if grep -q "ENABLE_SOCIAL_KEY_MANAGEMENT" $CONFIGURATION_FILE; then ENABLE_SOCIAL_KEY_MANAGEMENT=$(grep "ENABLE_SOCIAL_KEY_MANAGEMENT" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi @@ -1622,12 +1552,6 @@ function read_configuration { if grep -q "MICROBLOG_CODE" $CONFIGURATION_FILE; then MICROBLOG_CODE=$(grep "MICROBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi - if grep -q "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE; then - REDMATRIX_DOMAIN_NAME=$(grep "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - if grep -q "REDMATRIX_CODE" $CONFIGURATION_FILE; then - REDMATRIX_CODE=$(grep "REDMATRIX_CODE" $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