Name not email

This commit is contained in:
Bob Mottram 2015-09-20 18:20:47 +01:00
parent 71364695e6
commit b198c6312f
1 changed files with 7 additions and 7 deletions

View File

@ -2417,12 +2417,12 @@ function get_mariadb_owncloud_admin_password {
function backup_directory_to_usb {
if [[ $BACKUP_TYPE == 'obnam' ]]; then
BACKUP_KEY_EXISTS=$("gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\"")
BACKUP_KEY_EXISTS=$("gpg --list-keys \"$MY_NAME (backup key)\"")
if [ ! "$?" = "0" ]; then
echo "Backup key could not be found"
exit 43382
fi
MY_BACKUP_KEY_ID=$(gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
echo "obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME
else
# For rsyncrypto usage see http://archive09.linux.com/feature/125322
@ -3566,12 +3566,12 @@ function create_freedns_updater {
function backup_directory_to_friend {
if [[ $BACKUP_TYPE == 'obnam' ]]; then
BACKUP_KEY_EXISTS=$("gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\"")
BACKUP_KEY_EXISTS=$("gpg --list-keys \"$MY_NAME (backup key)\"")
if [ ! "$?" = "0" ]; then
echo "Backup key could not be found"
exit 43382
fi
MY_BACKUP_KEY_ID=$(gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
echo -n 'obnam backup -r $SERVER_DIRECTORY/backup/ ' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "--encrypt-with $MY_BACKUP_KEY_ID " >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -6327,7 +6327,7 @@ function configure_backup_key {
fi
apt-get -y install gnupg
BACKUP_KEY_EXISTS=$(gpg --list-keys "$MY_EMAIL_ADDRESS (backup key)")
BACKUP_KEY_EXISTS=$(gpg --list-keys "$MY_NAME (backup key)")
if [ "$?" = "0" ]; then
return
fi
@ -6344,12 +6344,12 @@ function configure_backup_key {
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
shred -zu /home/$MY_USERNAME/gpg-genkey.conf
BACKUP_KEY_EXISTS=$(su -c "gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\"" - $MY_USERNAME)
BACKUP_KEY_EXISTS=$(su -c "gpg --list-keys \"$MY_NAME (backup key)\"" - $MY_USERNAME)
if [ ! "$?" = "0" ]; then
echo 'Backup key could not be created'
exit 43382
fi
MY_BACKUP_KEY_ID=$(su -c "gpg --list-keys \"$MY_EMAIL_ADDRESS (backup key)\" | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
MY_BACKUP_KEY_ID=$(su -c "gpg --list-keys \"$MY_NAME (backup key)\" | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
echo "Backup key: $MY_BACKUP_KEY_ID"
MY_BACKUP_KEY=/home/$MY_USERNAME/backup_key
su -c "gpg --output ${MY_BACKUP_KEY}_public.asc --armor --export $MY_BACKUP_KEY_ID" - $MY_USERNAME