Backup and restore blocklist
This commit is contained in:
parent
7daf077ee1
commit
7a222289d0
|
@ -259,6 +259,22 @@ function prepare_directories {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backup_blocklist {
|
||||||
|
if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo $"Backing up ${PROJECT_NAME} blocklist"
|
||||||
|
temp_backup_dir=/root/tempbackupblocklist
|
||||||
|
if [ ! -d $temp_backup_dir ]; then
|
||||||
|
mkdir -p $temp_backup_dir
|
||||||
|
fi
|
||||||
|
if [ -f $NODEJS_INSTALLED_APPS_FILE ]; then
|
||||||
|
cp -f /root/${PROJECT_NAME}-firewall-domains.cfg $temp_backup_dir
|
||||||
|
fi
|
||||||
|
backup_directory_to_usb $temp_backup_dir blocklist
|
||||||
|
rm -rf $temp_backup_dir
|
||||||
|
}
|
||||||
|
|
||||||
function backup_configfiles {
|
function backup_configfiles {
|
||||||
echo $"Backing up ${PROJECT_NAME} configuration files"
|
echo $"Backing up ${PROJECT_NAME} configuration files"
|
||||||
temp_backup_dir=/root/tempbackupconfig
|
temp_backup_dir=/root/tempbackupconfig
|
||||||
|
@ -285,6 +301,7 @@ function backup_configfiles {
|
||||||
cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
|
cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
|
||||||
fi
|
fi
|
||||||
backup_directory_to_usb $temp_backup_dir configfiles
|
backup_directory_to_usb $temp_backup_dir configfiles
|
||||||
|
rm -rf $temp_backup_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_admin_readme {
|
function backup_admin_readme {
|
||||||
|
@ -335,6 +352,7 @@ prepare_directories
|
||||||
backup_directories
|
backup_directories
|
||||||
backup_apps local
|
backup_apps local
|
||||||
backup_configfiles
|
backup_configfiles
|
||||||
|
backup_blocklist
|
||||||
backup_admin_readme
|
backup_admin_readme
|
||||||
backup_mariadb
|
backup_mariadb
|
||||||
backup_extra_directories local
|
backup_extra_directories local
|
||||||
|
|
|
@ -105,6 +105,22 @@ function restart_site {
|
||||||
SUSPENDED_SITE=
|
SUSPENDED_SITE=
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backup_blocklist {
|
||||||
|
if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo $"Backing up ${PROJECT_NAME} blocklist"
|
||||||
|
temp_backup_dir=/root/tempbackupblocklist
|
||||||
|
if [ ! -d $temp_backup_dir ]; then
|
||||||
|
mkdir -p $temp_backup_dir
|
||||||
|
fi
|
||||||
|
if [ -f $NODEJS_INSTALLED_APPS_FILE ]; then
|
||||||
|
cp -f /root/${PROJECT_NAME}-firewall-domains.cfg $temp_backup_dir
|
||||||
|
fi
|
||||||
|
backup_directory_to_friend $temp_backup_dir blocklist
|
||||||
|
rm -rf $temp_backup_dir
|
||||||
|
}
|
||||||
|
|
||||||
function backup_configfiles {
|
function backup_configfiles {
|
||||||
echo $"Backing up ${PROJECT_NAME} configuration files"
|
echo $"Backing up ${PROJECT_NAME} configuration files"
|
||||||
temp_backup_dir=/root/tempbackupconfig
|
temp_backup_dir=/root/tempbackupconfig
|
||||||
|
@ -386,6 +402,7 @@ fi
|
||||||
|
|
||||||
backup_configfiles
|
backup_configfiles
|
||||||
if [[ $TEST_MODE == "no" ]]; then
|
if [[ $TEST_MODE == "no" ]]; then
|
||||||
|
backup_blocklist
|
||||||
backup_users
|
backup_users
|
||||||
backup_letsencrypt
|
backup_letsencrypt
|
||||||
backup_passwordstore
|
backup_passwordstore
|
||||||
|
|
|
@ -1102,6 +1102,7 @@ function restore_data_from_storage {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
utils_installed=(configfiles
|
utils_installed=(configfiles
|
||||||
|
blocklist
|
||||||
mariadb
|
mariadb
|
||||||
letsencrypt
|
letsencrypt
|
||||||
passwords
|
passwords
|
||||||
|
|
|
@ -111,6 +111,27 @@ function copy_gpg_keys {
|
||||||
gpg_set_permissions root
|
gpg_set_permissions root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restore_blocklist {
|
||||||
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
|
if [[ $RESTORE_APP != 'blocklist' ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this restores *.cfg and COMPLETION_FILE
|
||||||
|
if [ -d $USB_MOUNT/backup/blocklist ]; then
|
||||||
|
echo $"Restoring blocklist"
|
||||||
|
temp_restore_dir=/root/tempblocklist
|
||||||
|
restore_directory_from_usb $temp_restore_dir blocklist
|
||||||
|
|
||||||
|
if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||||
|
cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf $temp_restore_dir
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function restore_configfiles {
|
function restore_configfiles {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'configfiles' ]]; then
|
if [[ $RESTORE_APP != 'configfiles' ]]; then
|
||||||
|
@ -119,9 +140,9 @@ function restore_configfiles {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# this restores *.cfg and COMPLETION_FILE
|
# this restores *.cfg and COMPLETION_FILE
|
||||||
if [ -d $USB_MOUNT/backup/config ]; then
|
if [ -d $USB_MOUNT/backup/configfiles ]; then
|
||||||
echo $"Restoring configuration files"
|
echo $"Restoring configuration files"
|
||||||
temp_restore_dir=/root/tempconfig
|
temp_restore_dir=/root/tempconfigfiles
|
||||||
restore_directory_from_usb $temp_restore_dir configfiles
|
restore_directory_from_usb $temp_restore_dir configfiles
|
||||||
|
|
||||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||||
|
@ -741,6 +762,7 @@ backup_mount_drive ${1} ${ADMIN_USERNAME} ${2}
|
||||||
check_backup_exists
|
check_backup_exists
|
||||||
check_admin_user
|
check_admin_user
|
||||||
copy_gpg_keys
|
copy_gpg_keys
|
||||||
|
restore_blocklist
|
||||||
restore_configfiles
|
restore_configfiles
|
||||||
same_admin_user
|
same_admin_user
|
||||||
restore_passwordstore
|
restore_passwordstore
|
||||||
|
|
|
@ -102,15 +102,37 @@ function copy_gpg_keys {
|
||||||
gpg_set_permissions root
|
gpg_set_permissions root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restore_blocklist {
|
||||||
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
|
if [[ $RESTORE_APP != 'blocklist' ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this restores *.cfg and COMPLETION_FILE
|
||||||
|
if [ -d $USB_MOUNT/backup/blocklist ]; then
|
||||||
|
echo $"Restoring blocklist"
|
||||||
|
temp_restore_dir=/root/tempblocklist
|
||||||
|
restore_directory_from_friend $temp_restore_dir blocklist
|
||||||
|
restore_directory_from_usb $temp_restore_dir blocklist
|
||||||
|
|
||||||
|
if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||||
|
cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf $temp_restore_dir
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function restore_configfiles {
|
function restore_configfiles {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'configfiles' ]]; then
|
if [[ $RESTORE_APP != 'configfiles' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/config ]; then
|
if [ -d $SERVER_DIRECTORY/backup/configfiles ]; then
|
||||||
echo $"Restoring configuration files"
|
echo $"Restoring configuration files"
|
||||||
temp_restore_dir=/root/tempconfig
|
temp_restore_dir=/root/tempconfigfiles
|
||||||
restore_directory_from_friend $temp_restore_dir configfiles
|
restore_directory_from_friend $temp_restore_dir configfiles
|
||||||
|
|
||||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||||
|
@ -655,6 +677,7 @@ function restore_email {
|
||||||
${PROJECT_NAME}-recoverkey -u ${ADMIN_USERNAME} -l $BACKUP_LIST
|
${PROJECT_NAME}-recoverkey -u ${ADMIN_USERNAME} -l $BACKUP_LIST
|
||||||
|
|
||||||
copy_gpg_keys
|
copy_gpg_keys
|
||||||
|
restore_blocklist
|
||||||
restore_configfiles
|
restore_configfiles
|
||||||
restore_passwordstore
|
restore_passwordstore
|
||||||
restore_mariadb
|
restore_mariadb
|
||||||
|
|
Loading…
Reference in New Issue