Restore gpg keys separately

This enables the system to be upgraded without overwriting gpg2 config with gpg1
This commit is contained in:
Bob Mottram 2017-06-24 18:09:39 +01:00
parent e3618921c4
commit 5f0aba7db3
2 changed files with 11 additions and 16 deletions

View File

@ -108,8 +108,7 @@ function check_admin_user {
function copy_gpg_keys {
echo $"Copying GPG keys from admin user to root"
cp -r /home/$ADMIN_USERNAME/.gnupg /root
chmod 700 /root/.gnupg
chmod 600 /root/.gnupg/*
gpg_set_permissions root
}
function restore_configfiles {
@ -312,11 +311,10 @@ function restore_mutt_settings {
}
function restore_gpg {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gpg' ]]; then
return
fi
if [[ $RESTORE_APP != 'gpg' ]]; then
return
fi
if [ -d $USB_MOUNT/backup/gnupg ]; then
for d in $USB_MOUNT/backup/gnupg/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
@ -335,6 +333,7 @@ function restore_gpg {
exit 276
fi
rm -rf $temp_restore_dir
gpg_set_permissions $USERNAME
if [[ "$USERNAME" == "$ADMIN_USERNAME" ]]; then
cp -r /home/$USERNAME/.gnupg /root
if [ ! "$?" = "0" ]; then
@ -342,8 +341,7 @@ function restore_gpg {
backup_unmount_drive
exit 283
fi
chmod 700 /root/.gnupg
chmod 600 /root/.gnupg/*
gpg_set_permissions root
fi
fi
done

View File

@ -99,8 +99,7 @@ DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
function copy_gpg_keys {
echo $"Copying GPG keys from admin user to root"
cp -r /home/$ADMIN_USERNAME/.gnupg /root
chmod 700 /root/.gnupg
chmod 600 /root/.gnupg/*
gpg_set_permissions root
}
function restore_configfiles {
@ -282,11 +281,10 @@ function restore_mutt_settings {
}
function restore_gpg {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gpg' ]]; then
return
fi
if [[ $RESTORE_APP != 'gpg' ]]; then
return
fi
for d in $SERVER_DIRECTORY/backup/gnupg/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
@ -308,8 +306,7 @@ function restore_gpg {
if [ ! "$?" = "0" ]; then
exit 283
fi
chmod 700 /root/.gnupg
chmod 600 /root/.gnupg/*
gpg_set_permissions root
fi
fi
fi