From 43c5e1dd157915f11cc47d0cb9b40109b8b6038d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 26 Oct 2016 19:58:48 +0100 Subject: [PATCH] Tidy up initial loading of some files from usb --- src/freedombone-app-xmpp | 21 +++++++++++++++++++-- src/freedombone-base-email | 15 --------------- src/freedombone-utils-setup | 18 +----------------- 3 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index b005f69f..743615be 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -345,8 +345,25 @@ function install_xmpp_main { check_certificates xmpp fi fi - chown prosody:prosody /etc/ssl/private/xmpp.key - chown prosody:prosody /etc/ssl/certs/xmpp.* + if [ -f /etc/ssl/private/xmpp.key ]; then + chown prosody:prosody /etc/ssl/private/xmpp.key + fi + if [ -f /etc/ssl/certs/xmpp.crt ]; then + chown prosody:prosody /etc/ssl/certs/xmpp.crt + fi + if [ -f /etc/ssl/certs/xmpp.dhparam ]; then + chown prosody:prosody /etc/ssl/certs/xmpp.dhparam + fi + if [ -f /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key ]; then + chown prosody:prosody /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key + fi + if [ -f /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then + chown prosody:prosody /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem + fi + if [ -f /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.dhparam ]; then + chown prosody:prosody /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.dhparam + fi + cp -a /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/xmpp.cfg.lua if [[ $(cert_exists ${DEFAULT_DOMAIN_NAME} pem) == "1" ]]; then diff --git a/src/freedombone-base-email b/src/freedombone-base-email index d5cf791a..c03bd1ae 100755 --- a/src/freedombone-base-email +++ b/src/freedombone-base-email @@ -60,11 +60,6 @@ MY_GPG_PRIVATE_KEY= # optionally specify your public key ID MY_GPG_PUBLIC_KEY_ID= -# If you have existing mail within a Maildir -# you can specify the directory here and the files -# will be imported -IMPORT_MAILDIR= - EXIM_ONION_REPO="https://github.com/petterreinholdtsen/exim4-smtorp" # automatic archiving of email @@ -624,16 +619,6 @@ function import_email { fi return fi - if [ $IMPORT_MAILDIR ]; then - if [ -d $IMPORT_MAILDIR ]; then - echo $'Transfering email files' - cp -r $IMPORT_MAILDIR /home/$MY_USERNAME - chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Maildir - else - echo $"Email import directory $IMPORT_MAILDIR not found" - exit 9 - fi - fi mark_completed $FUNCNAME if [[ $SYSTEM_TYPE == "mail"* ]]; then function_check backup_to_friends_servers diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index e40c8c49..50fd8e50 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -176,16 +176,13 @@ function search_for_attached_usb_drive { if [[ $(is_completed $FUNCNAME) == "1" ]]; then return fi + detect_usb_drive if [ -b $USB_DRIVE ]; then if [ ! -d $USB_MOUNT ]; then echo $'Mounting USB drive' mkdir $USB_MOUNT mount $USB_DRIVE $USB_MOUNT fi - if [ -d $USB_MOUNT/Maildir ]; then - echo $'Maildir found on USB drive' - IMPORT_MAILDIR=$USB_MOUNT/Maildir - fi if [ -d $USB_MOUNT/.gnupg ]; then echo $'Importing GPG keyring' cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME @@ -197,12 +194,6 @@ function search_for_attached_usb_drive { fi fi - if [ -f $USB_MOUNT/.procmailrc ]; then - echo $'Importing procmail settings' - cp $USB_MOUNT/.procmailrc /home/$MY_USERNAME - chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc - fi - if [ -f $USB_MOUNT/private_key.gpg ]; then echo $'GPG private key found on USB drive' MY_GPG_PRIVATE_KEY=$USB_MOUNT/private_key.gpg @@ -212,13 +203,6 @@ function search_for_attached_usb_drive { MY_GPG_PUBLIC_KEY=$USB_MOUNT/public_key.gpg fi - if [ -d $USB_MOUNT/prosody ]; then - if [ ! -d $XMPP_DIRECTORY ]; then - mkdir $XMPP_DIRECTORY - fi - cp -r $USB_MOUNT/prosody/* $XMPP_DIRECTORY - chown -R prosody:prosody $XMPP_DIRECTORY - fi if [ -d $USB_MOUNT/.ssh ]; then echo $'Importing ssh keys' cp -r $USB_MOUNT/.ssh /home/$MY_USERNAME