Backup and restore sks config files

This commit is contained in:
Bob Mottram 2017-07-30 12:19:52 +01:00
parent 972e9b463b
commit efe6c6f315
1 changed files with 32 additions and 0 deletions

View File

@ -125,6 +125,14 @@ function upgrade_keyserver {
}
function backup_local_keyserver {
source_directory=/etc/sks
if [ -d $source_directory ]; then
systemctl stop sks
dest_directory=keyserverconfig
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
systemctl start sks
fi
if [[ "$(check_keyserver_directory_size)" != "0" ]]; then
echo $'WARNING: Keyserver database size is too large to backup'
return
@ -145,6 +153,14 @@ function restore_local_keyserver {
fi
echo $"Restoring SKS Keyserver"
systemctl stop sks
temp_restore_dir=/root/tempkeyserverconfig
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir keyserverconfig
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
rm -rf $temp_restore_dir
chown -Rc debian-sks: /etc/sks/sksconf
temp_restore_dir=/root/tempkeyserver
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir keyserver
@ -172,6 +188,14 @@ function restore_local_keyserver {
}
function backup_remote_keyserver {
source_directory=/etc/sks
if [ -d $source_directory ]; then
systemctl stop sks
dest_directory=keyserverconfig
function_check backup_directory_to_friend
backup_directory_to_friend $source_directory $dest_directory
systemctl start sks
fi
if [[ "$(check_keyserver_directory_size)" != "0" ]]; then
echo $'WARNING: Keyserver database size is too large to backup'
return
@ -192,6 +216,14 @@ function restore_remote_keyserver {
fi
echo $"Restoring SKS Keyserver"
systemctl stop sks
temp_restore_dir=/root/tempkeyserverconfig
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir keyserverconfig
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
rm -rf $temp_restore_dir
chown -Rc debian-sks: /etc/sks/sksconf
temp_restore_dir=/root/tempkeyserver
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir keyserver