Tidying
This commit is contained in:
parent
911ef6873c
commit
38cb59be97
243
src/freedombone
243
src/freedombone
|
@ -185,7 +185,6 @@ HUBZILLA_CODE=
|
||||||
HUBZILLA_REPO="https://github.com/redmatrix/hubzilla.git"
|
HUBZILLA_REPO="https://github.com/redmatrix/hubzilla.git"
|
||||||
HUBZILLA_ADDONS_REPO="https://github.com/redmatrix/hubzilla-addons.git"
|
HUBZILLA_ADDONS_REPO="https://github.com/redmatrix/hubzilla-addons.git"
|
||||||
HUBZILLA_ADMIN_PASSWORD=
|
HUBZILLA_ADMIN_PASSWORD=
|
||||||
RESTORE_HUBZILLA_SCRIPT_NAME="restorehubzilla"
|
|
||||||
HUBZILLA_COMMIT='609e42cdd8facae0a673bb1a370c44225d22b1cd'
|
HUBZILLA_COMMIT='609e42cdd8facae0a673bb1a370c44225d22b1cd'
|
||||||
|
|
||||||
# Domain name for git hosting installation
|
# Domain name for git hosting installation
|
||||||
|
@ -2722,247 +2721,6 @@ function get_mariadb_owncloud_admin_password {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_directory_from_usb {
|
|
||||||
script_name=$1
|
|
||||||
echo 'function restore_directory_from_usb {' >> $script_name
|
|
||||||
echo " BACKUP_CERTIFICATE=$BACKUP_CERTIFICATE" >> $script_name
|
|
||||||
echo ' if [ ! -d ${1} ]; then' >> $script_name
|
|
||||||
echo ' mkdir ${1}' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
|
|
||||||
if [[ $BACKUP_TYPE == 'obnam' ]]; then
|
|
||||||
echo ' obnam restore -r $USB_MOUNT/backup/${2} --to ${1}' >> $script_name
|
|
||||||
else
|
|
||||||
echo ' rsyncrypto -v -d -r $USB_MOUNT/backup/${2} ${1} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE' >> $script_name
|
|
||||||
fi
|
|
||||||
echo '}' >> $script_name
|
|
||||||
}
|
|
||||||
|
|
||||||
function restore_database {
|
|
||||||
script_name=$1
|
|
||||||
echo 'function restore_database {' >> $script_name
|
|
||||||
if [[ $BACKUP_TYPE == 'obnam' ]]; then
|
|
||||||
echo ' RESTORE_SUBDIR="root"' >> $script_name
|
|
||||||
else
|
|
||||||
echo ' RESTORE_SUBDIR="usb/backup/${1}data"' >> $script_name
|
|
||||||
fi
|
|
||||||
echo '' >> $script_name
|
|
||||||
echo ' if [ -d $USB_MOUNT/backup/${1} ]; then' >> $script_name
|
|
||||||
echo ' echo "Restoring ${1} database"' >> $script_name
|
|
||||||
echo ' restore_directory_from_usb "/root/temp${1}data" "${1}data"' >> $script_name
|
|
||||||
echo ' if [ ! -f /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql ]; then' >> $script_name
|
|
||||||
echo ' echo "Unable to restore ${1} database"' >> $script_name
|
|
||||||
echo ' rm -rf /root/temp${1}data' >> $script_name
|
|
||||||
echo ' umount $USB_MOUNT' >> $script_name
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> $script_name
|
|
||||||
echo ' exit 503' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo -n ' mysqlsuccess=$(mysql -u root --password=$DATABASE_PASSWORD ' >> $script_name
|
|
||||||
echo '${1} -o < /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql)' >> $script_name
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> $script_name
|
|
||||||
echo ' echo "$mysqlsuccess"' >> $script_name
|
|
||||||
echo ' umount $USB_MOUNT' >> $script_name
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> $script_name
|
|
||||||
echo ' exit 964' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' shred -zu /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/*' >> $script_name
|
|
||||||
echo ' rm -rf /root/temp${1}data' >> $script_name
|
|
||||||
echo ' echo "Restoring ${1} installation"' >> $script_name
|
|
||||||
echo ' if [ ! -d /root/temp${1} ]; then' >> $script_name
|
|
||||||
echo ' mkdir /root/temp${1}' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' restore_directory_from_usb "/root/temp${1}" "${1}"' >> $script_name
|
|
||||||
if [[ $BACKUP_TYPE == 'obnam' ]]; then
|
|
||||||
echo ' RESTORE_SUBDIR="var"' >> $script_name
|
|
||||||
else
|
|
||||||
echo ' RESTORE_SUBDIR="usb/backup/${1}"' >> $script_name
|
|
||||||
fi
|
|
||||||
echo ' if [ ${2} ]; then' >> $script_name
|
|
||||||
echo ' if [ -d /var/www/${2}/htdocs ]; then' >> $script_name
|
|
||||||
echo ' if [ -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then' >> $script_name
|
|
||||||
echo ' rm -rf /var/www/${2}/htdocs' >> $script_name
|
|
||||||
echo ' mv /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs /var/www/${2}/' >> $script_name
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> $script_name
|
|
||||||
echo ' umount $USB_MOUNT' >> $script_name
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> $script_name
|
|
||||||
echo ' exit 683' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' if [ -d /etc/letsencrypt/live/${2} ]; then' >> $script_name
|
|
||||||
echo ' ln -s /etc/letsencrypt/live/${2}/privkey.pem /etc/ssl/private/${2}.key' >> $script_name
|
|
||||||
echo ' ln -s /etc/letsencrypt/live/${2}/fullchain.pem /etc/ssl/certs/${2}.pem' >> $script_name
|
|
||||||
echo ' else' >> $script_name
|
|
||||||
echo ' # Ensure that the bundled SSL cert is being used' >> $script_name
|
|
||||||
echo ' if [ -f /etc/ssl/certs/${2}.bundle.crt ]; then' >> $script_name
|
|
||||||
echo ' sed -i "s|${2}.crt|${2}.bundle.crt|g" /etc/nginx/sites-available/${2}' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo ' fi' >> $script_name
|
|
||||||
echo '}' >> $script_name
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_restore_hubzilla_script {
|
|
||||||
if grep -Fxq "create_restore_hubzilla_script" $COMPLETION_FILE; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
apt-get -y install rsyncrypto cryptsetup obnam
|
|
||||||
|
|
||||||
get_mariadb_password
|
|
||||||
get_mariadb_hubzilla_admin_password
|
|
||||||
get_mariadb_git_admin_password
|
|
||||||
|
|
||||||
echo '#!/bin/bash' > /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "USB_DRIVE=$USB_DRIVE" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ $1 ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "USB_MOUNT=$USB_MOUNT" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ $2 ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' MY_USERNAME=$2' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ ! -b $USB_DRIVE ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Please attach a USB drive"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' exit 1' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ ! -d $USB_MOUNT ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' mkdir $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' cryptsetup luksClose encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' cryptsetup luksOpen $USB_DRIVE encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' if [ "$?" = "0" ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' USB_DRIVE=/dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo -n ' mount $USB_DRIVE ' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '$USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ ! -d $USB_MOUNT/backup ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "No backup directory found on the USB drive."' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' exit 2' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo 'echo "Checking that user exists"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ ! -d /home/$MY_USERNAME ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Username $MY_USERNAME not found. Reinstall Freedombone with this username."' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' exit 295' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo 'echo "Copying GPG keys to root"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'cp -r /home/$MY_USERNAME/.gnupg /root' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo '# MariaDB password' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo -n 'DATABASE_PASSWORD=$(cat ' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
restore_directory_from_usb /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
restore_database /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
|
||||||
echo 'if [ -f $USB_MOUNT/backup/key.gpg ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " if [ -f $BACKUP_CERTIFICATE.new ]; then" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " rm $BACKUP_CERTIFICATE.new" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' cp $USB_MOUNT/backup/key.gpg /root/tempbackupkey.gpg' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " gpg /root/tempbackupkey.gpg" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " if [ -f /root/tempbackupkey ]; then" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Backup key decrypted"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " cp /root/tempbackupkey $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " shred -zu /root/tempbackupkey" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " chmod 400 $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Backup certificate installed"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' else' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Unable to decrypt the backup key"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' exit 735' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo "if [ ! -f $BACKUP_CERTIFICATE ]; then" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " echo 'No backup key was found. Copy your backup key to $BACKUP_CERTIFICATE'" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' exit 563' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
fi
|
|
||||||
|
|
||||||
BACKUP_INCLUDES_WEBSITES="no"
|
|
||||||
|
|
||||||
if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then
|
|
||||||
BACKUP_INCLUDES_WEBSITES="yes"
|
|
||||||
echo "restore_database hubzilla $HUBZILLA_DOMAIN_NAME" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ -d $USB_MOUNT/backup/hubzilla ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3 ]; then" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " mkdir -p /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " fi" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " chmod 777 /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo " chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/*" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' if [ -d /root/temphubzilla ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/temphubzilla' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 'sync' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "# Unmount the USB drive" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'umount $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
if [[ $BACKUP_INCLUDES_WEBSITES == "yes" ]]; then
|
|
||||||
echo "# Restart the web server" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "service nginx restart" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo "service php5-fpm restart" >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
fi
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'echo "Setting permissions"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' chown -R $USERNAME:$USERNAME /home/$USERNAME' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'done' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo 'if [[ $USB_DRIVE == /dev/mapper/encrypted_usb ]]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' echo "Unmount encrypted USB"' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' cryptsetup luksClose encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo 'echo "Restore of Hubzilla from USB drive is complete. You can now remove it."' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
echo 'exit 0' >> /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
chmod 400 /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
chmod +x /usr/bin/$RESTORE_HUBZILLA_SCRIPT_NAME
|
|
||||||
|
|
||||||
echo 'create_restore_hubzilla_script' >> $COMPLETION_FILE
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_freedns_updater {
|
function create_freedns_updater {
|
||||||
# currently inadyn doesn't work as expected with freeDNS, so this is a workaround
|
# currently inadyn doesn't work as expected with freeDNS, so this is a workaround
|
||||||
if grep -Fxq "create_freedns_updater" $COMPLETION_FILE; then
|
if grep -Fxq "create_freedns_updater" $COMPLETION_FILE; then
|
||||||
|
@ -9195,7 +8953,6 @@ configure_firewall_for_dlna
|
||||||
install_mediagoblin
|
install_mediagoblin
|
||||||
#install_ipfs
|
#install_ipfs
|
||||||
repair_databases_script
|
repair_databases_script
|
||||||
create_restore_hubzilla_script
|
|
||||||
backup_to_friends_servers
|
backup_to_friends_servers
|
||||||
intrusion_detection
|
intrusion_detection
|
||||||
install_final
|
install_final
|
||||||
|
|
Loading…
Reference in New Issue