install_postfix_advanced.sh: add default values if no configuration file is present or some values not given.

This commit is contained in:
Christoph 2018-10-24 14:29:01 +02:00
parent d8545aa36d
commit 6e8e46af98

View File

@ -82,6 +82,13 @@ echo_skipped() {
trap clean_up SIGHUP SIGINT SIGTERM
# -------------
# --- Some default settings
# -------------
DEFAULT_ADMIN_EMAIL="argus@oopen.de"
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
@ -102,6 +109,21 @@ if [[ -f "$conf_file" ]]; then
source $conf_file
fi
[[ -z "$_ADMIN_EMAIL" ]] && _ADMIN_EMAIL="$DEFAULT_ADMIN_EMAIL"
# -------------
# --- Set default values for some non existent variables (i.e. no configuration file is present)
# -------------
if [[ -z "$_HOSTNAME" ]] ; then
_HOSTNAME="$(hostname -f)"
_HOSTNAME_SHORT="$(hostname)"
[[ "$_HOSTNAME" = "$_HOSTNAME_SHORT" ]] && _HOSTNAME=""
fi
clear
echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m"
echo
@ -128,6 +150,22 @@ else
done
fi
# -------------
# --- Some further default values depending on Hostname
# -------------
# - Set default values for ipv4- and ipv6-address
# -
if [[ -z $_IPV4 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV4="$(dig +short "$_HOSTNAME" A)"
fi
if [[ -z $_IPV6 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV6="$(dig +short "$_HOSTNAME" AAAA)"
fi
IPV4=
echo ""
echo -e "\033[32m--\033[m"