To keep things simple don't treat the default domain name as a special snowflake

This commit is contained in:
Bob Mottram 2016-11-06 15:05:49 +00:00
parent 17623bd26b
commit 6183b8dfde
1 changed files with 11 additions and 25 deletions

View File

@ -112,21 +112,17 @@ function remove_mailpile {
rm /etc/systemd/system/mailpile.service rm /etc/systemd/system/mailpile.service
read_config_param "MAILPILE_DOMAIN_NAME" read_config_param "MAILPILE_DOMAIN_NAME"
if [[ "$MAILPILE_DOMAIN_NAME" != "$DEFAULT_DOMAIN_NAME" ]]; then nginx_dissite $MAILPILE_DOMAIN_NAME
nginx_dissite $MAILPILE_DOMAIN_NAME remove_certs ${MAILPILE_DOMAIN_NAME}
remove_certs ${MAILPILE_DOMAIN_NAME} if [ -f /etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME ]; then
if [ -f /etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME ]; then rm -f /etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME
rm -f /etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME
fi
if [ -d /var/www/$MAILPILE_DOMAIN_NAME ]; then
rm -rf /var/www/$MAILPILE_DOMAIN_NAME
fi
function_check remove_ddns_domain
remove_ddns_domain $MAILPILE_DOMAIN_NAME
deluser --remove-all-files mailpile
else
deluser mailpile
fi fi
if [ -d /var/www/$MAILPILE_DOMAIN_NAME ]; then
rm -rf /var/www/$MAILPILE_DOMAIN_NAME
fi
function_check remove_ddns_domain
remove_ddns_domain $MAILPILE_DOMAIN_NAME
deluser --remove-all-files mailpile
remove_config_param MAILPILE_DOMAIN_NAME remove_config_param MAILPILE_DOMAIN_NAME
remove_config_param MAILPILE_CODE remove_config_param MAILPILE_CODE
@ -179,12 +175,6 @@ function install_mailpile {
# create folders and tags # create folders and tags
su -c "cd /var/www/$MAILPILE_DOMAIN_NAME/htdocs && ./mp --setup" - mailpile su -c "cd /var/www/$MAILPILE_DOMAIN_NAME/htdocs && ./mp --setup" - mailpile
if [[ $ONION_ONLY == 'no' ]]; then
if [[ "$MAILPILE_DOMAIN_NAME" == "$DEFAULT_DOMAIN_NAME" ]]; then
su -c "cd /var/www/$MAILPILE_DOMAIN_NAME/htdocs && ./mp set sys.http_path /mail" - mailpile
fi
fi
echo '[Unit]' > /etc/systemd/system/mailpile.service echo '[Unit]' > /etc/systemd/system/mailpile.service
echo 'Description=Mailpile Email Client' >> /etc/systemd/system/mailpile.service echo 'Description=Mailpile Email Client' >> /etc/systemd/system/mailpile.service
echo 'After=syslog.target network.target nginx.target' >> /etc/systemd/system/mailpile.service echo 'After=syslog.target network.target nginx.target' >> /etc/systemd/system/mailpile.service
@ -262,11 +252,7 @@ function install_mailpile {
fi fi
function_check create_site_certificate function_check create_site_certificate
if [[ "$MAILPILE_DOMAIN_NAME" == "$DEFAULT_DOMAIN_NAME" ]]; then if [ ! -f /etc/ssl/certs/${MAILPILE_DOMAIN_NAME}.pem ]; then
if [ ! -f /etc/ssl/certs/${MAILPILE_DOMAIN_NAME}.pem ]; then
create_site_certificate $MAILPILE_DOMAIN_NAME 'yes'
fi
else
create_site_certificate $MAILPILE_DOMAIN_NAME 'yes' create_site_certificate $MAILPILE_DOMAIN_NAME 'yes'
fi fi