|
|
@ -7,33 +7,33 @@ FORCE=${FORCE:-false} |
|
|
# FUNCTIONS |
|
|
# FUNCTIONS |
|
|
|
|
|
|
|
|
function install_postfix { |
|
|
function install_postfix { |
|
|
if $FORCE || ! systemctl is-active postfix.service --quiet; then |
|
|
|
|
|
debconf-set-selections <<EOF |
|
|
|
|
|
|
|
|
if $FORCE || ! systemctl is-active postfix.service --quiet; then |
|
|
|
|
|
debconf-set-selections << EOF |
|
|
postfix postfix/mailname string $(hostname -f) |
|
|
postfix postfix/mailname string $(hostname -f) |
|
|
postfix postfix/main_mailer_type string 'Internet Site' |
|
|
postfix postfix/main_mailer_type string 'Internet Site' |
|
|
postfix postfix/mynetworks string '127.0.0.0/8' |
|
|
postfix postfix/mynetworks string '127.0.0.0/8' |
|
|
EOF |
|
|
EOF |
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix postgresql nginx fcgiwrap perl-doc micro debconf-utils |
|
|
|
|
|
postconf -e "inet_protocols = ipv4" |
|
|
|
|
|
systemctl restart postfix |
|
|
|
|
|
echo postfix installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo postfix already installed! |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix postgresql nginx fcgiwrap perl-doc micro debconf-utils certbot python3-certbot-nginx |
|
|
|
|
|
postconf -e "inet_protocols = ipv4" |
|
|
|
|
|
systemctl restart postfix |
|
|
|
|
|
echo postfix installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo postfix already installed! |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function alter_sympa_postgres_password_to { |
|
|
function alter_sympa_postgres_password_to { |
|
|
password="$1" |
|
|
|
|
|
/opt/miaou-bash/tools/append_or_replace '^db_passwd.*' "db_passwd\tsympa" /etc/sympa/sympa/sympa.conf |
|
|
|
|
|
sudo -u postgres -- psql -c "ALTER USER sympa PASSWORD '$password'" |
|
|
|
|
|
systemctl restart wwsympa.service |
|
|
|
|
|
|
|
|
password="$1" |
|
|
|
|
|
/opt/miaou-bash/tools/append_or_replace '^db_passwd.*' "db_passwd\tsympa" /etc/sympa/sympa/sympa.conf |
|
|
|
|
|
sudo -u postgres -- psql -c "ALTER USER sympa PASSWORD '$password'" |
|
|
|
|
|
systemctl restart wwsympa.service |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_sympa { |
|
|
function install_sympa { |
|
|
if $FORCE || ! systemctl is-active wwsympa.service --quiet; then |
|
|
|
|
|
listmasters="pvincent@artcode.re,jnoel@mithril.re" |
|
|
|
|
|
[[ $(hostname -d) == *.* ]] && listmasters+=",listmaster@$(hostname -d)" || true |
|
|
|
|
|
debconf-set-selections <<EOF |
|
|
|
|
|
|
|
|
if $FORCE || ! systemctl is-active wwsympa.service --quiet; then |
|
|
|
|
|
listmasters="pvincent@artcode.re,jnoel@mithril.re" |
|
|
|
|
|
[[ $(hostname -d) == *.* ]] && listmasters+=",listmaster@$(hostname -d)" || true |
|
|
|
|
|
debconf-set-selections << EOF |
|
|
sympa wwsympa/webserver_type select 'Other' |
|
|
sympa wwsympa/webserver_type select 'Other' |
|
|
sympa sympa/database-type string pgsql |
|
|
sympa sympa/database-type string pgsql |
|
|
sympa sympa/db_host string localhost |
|
|
sympa sympa/db_host string localhost |
|
|
@ -42,20 +42,20 @@ sympa sympa/db_user string sympa |
|
|
sympa sympa/language select fr |
|
|
sympa sympa/language select fr |
|
|
sympa sympa/listmaster string $listmasters |
|
|
sympa sympa/listmaster string $listmasters |
|
|
EOF |
|
|
EOF |
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y sympa |
|
|
|
|
|
systemctl disable sympasoap.{socket,service} |
|
|
|
|
|
systemctl stop sympasoap.{socket,service} |
|
|
|
|
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y sympa |
|
|
|
|
|
systemctl disable sympasoap.{socket,service} |
|
|
|
|
|
systemctl stop sympasoap.{socket,service} |
|
|
|
|
|
|
|
|
alter_sympa_postgres_password_to sympa |
|
|
|
|
|
echo sympa.service installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo sympa.service already installed! |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
alter_sympa_postgres_password_to sympa |
|
|
|
|
|
echo sympa.service installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo sympa.service already installed! |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_nginx_host { |
|
|
function install_nginx_host { |
|
|
if $FORCE || [[ ! -f /etc/nginx/sites-available/sympa.conf ]]; then |
|
|
|
|
|
cat <<EOF >/etc/nginx/sites-available/sympa.conf |
|
|
|
|
|
|
|
|
if $FORCE || [[ ! -f /etc/nginx/sites-available/sympa.conf ]]; then |
|
|
|
|
|
cat << EOF > /etc/nginx/sites-available/sympa.conf |
|
|
server { |
|
|
server { |
|
|
listen 80; |
|
|
listen 80; |
|
|
server_name _; |
|
|
server_name _; |
|
|
@ -80,12 +80,12 @@ server { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
EOF |
|
|
EOF |
|
|
cd /etc/nginx/sites-enabled && rm -f default && ln -sf ../sites-available/sympa.conf && cd |
|
|
|
|
|
systemctl reload nginx |
|
|
|
|
|
echo host for nginx installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo host for nginx already installed! |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
cd /etc/nginx/sites-enabled && rm -f default && ln -sf ../sites-available/sympa.conf && cd |
|
|
|
|
|
systemctl reload nginx |
|
|
|
|
|
echo host for nginx installed successfully! |
|
|
|
|
|
else |
|
|
|
|
|
echo host for nginx already installed! |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# MAIN |
|
|
# MAIN |
|
|
|