Tidy up initial loading of some files from usb

This commit is contained in:
Bob Mottram 2016-10-26 19:58:48 +01:00
parent 40e9dfe838
commit 43c5e1dd15
3 changed files with 20 additions and 34 deletions

View File

@ -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

View File

@ -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

View File

@ -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