Bob Mottram 10 years ago
parent
commit
4c55b10ebb
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      install-freedombone.sh

+ 4
- 4
install-freedombone.sh View File

308
   apt-get -y --force-yes install duplicity gnupg
308
   apt-get -y --force-yes install duplicity gnupg
309
 
309
 
310
   if [ ! MY_GPG_PUBLIC_KEY_ID ]; then
310
   if [ ! MY_GPG_PUBLIC_KEY_ID ]; then
311
-      MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}'" - $MY_USERNAME)
311
+	  MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
312
   fi
312
   fi
313
 
313
 
314
   echo '#!/bin/bash' > /usr/bin/$BACKUP_SCRIPT_NAME
314
   echo '#!/bin/bash' > /usr/bin/$BACKUP_SCRIPT_NAME
1606
   # if gpg keys directory was previously imported from usb
1606
   # if gpg keys directory was previously imported from usb
1607
   if [[ $GPG_KEYS_IMPORTED == "yes" && -d /home/$MY_USERNAME/.gnupg ]]; then
1607
   if [[ $GPG_KEYS_IMPORTED == "yes" && -d /home/$MY_USERNAME/.gnupg ]]; then
1608
       sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" /home/$MY_USERNAME/.gnupg/gpg.conf
1608
       sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" /home/$MY_USERNAME/.gnupg/gpg.conf
1609
-      MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}'" - $MY_USERNAME)
1609
+	  MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1610
       echo 'configure_gpg' >> $COMPLETION_FILE
1610
       echo 'configure_gpg' >> $COMPLETION_FILE
1611
       return
1611
       return
1612
   fi
1612
   fi
1643
       su -c "gpg --allow-secret-key-import --import $MY_GPG_PRIVATE_KEY" - $MY_USERNAME
1643
       su -c "gpg --allow-secret-key-import --import $MY_GPG_PRIVATE_KEY" - $MY_USERNAME
1644
       # for security ensure that the private key file doesn't linger around
1644
       # for security ensure that the private key file doesn't linger around
1645
       shred -zu $MY_GPG_PRIVATE_KEY
1645
       shred -zu $MY_GPG_PRIVATE_KEY
1646
-      MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}'" - $MY_USERNAME)
1646
+	  MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1647
   else
1647
   else
1648
       # Generate a GPG key
1648
       # Generate a GPG key
1649
       echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
1649
       echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
1656
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
1656
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
1657
       su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
1657
       su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
1658
       shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1658
       shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1659
-      MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}'" - $MY_USERNAME)
1659
+	  MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DOMAIN_NAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1660
       MY_GPG_PUBLIC_KEY=/tmp/public_key.gpg
1660
       MY_GPG_PUBLIC_KEY=/tmp/public_key.gpg
1661
       su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
1661
       su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
1662
   fi
1662
   fi