diff --git a/src/freedombone-base-email b/src/freedombone-base-email index e592ae19..a1c3769b 100755 --- a/src/freedombone-base-email +++ b/src/freedombone-base-email @@ -73,6 +73,29 @@ GPGIT_COMMIT='583dc76119f19420f8a33f606744faa7c8922738' # refresh gpg keys every few hours REFRESH_GPG_KEYS_HOURS=2 +function check_email_address_exists { + read_config_param ONION_ONLY + read_config_param MY_USERNAME + read_config_param DEFAULT_DOMAIN_NAME + read_config_param MY_EMAIL_ADDRESS + read_config_param DH_KEYLENGTH + + if [ ! $MY_USERNAME ]; then + echo $'No username for email installation' + exit 73672 + fi + if [ ! $DEFAULT_DOMAIN_NAME ]; then + echo $'No default domain name for email installation' + exit 57634 + fi + + my_email="$MY_EMAIL_ADDRESS" + if [ ${#my_email} -lt 3 ]; then + MY_EMAIL_ADDRESS=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME} + write_config_param "MY_EMAIL_ADDRESS" "$MY_EMAIL_ADDRESS" + fi +} + function backup_email { echo '' } @@ -1490,6 +1513,8 @@ function configure_gpg { fi apt-get -yq install gnupg + check_email_address_exists + gpg_dir=/home/$MY_USERNAME/.gnupg # if gpg keys directory was previously imported from usb @@ -1643,27 +1668,7 @@ function install_email { return fi - read_config_param ONION_ONLY - read_config_param MY_USERNAME - read_config_param DEFAULT_DOMAIN_NAME - read_config_param MY_EMAIL_ADDRESS - read_config_param DH_KEYLENGTH - - if [ ! $MY_USERNAME ]; then - echo $'No username for email installation' - exit 73672 - fi - if [ ! $DEFAULT_DOMAIN_NAME ]; then - echo $'No default domain name for email installation' - exit 57634 - fi - - my_email="$MY_EMAIL_ADDRESS" - if [ ${#my_email} -lt 3 ]; then - MY_EMAIL_ADDRESS=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME} - write_config_param "MY_EMAIL_ADDRESS" "$MY_EMAIL_ADDRESS" - fi - + check_email_address_exists install_email_basic #install_email_with_tor