mirror of
https://github.com/bashclub/proxmox-zfs-postinstall.git
synced 2024-12-25 17:50:13 +01:00
Autofill mailconfig
This commit is contained in:
parent
8c1cf0c4b6
commit
44c79b86ca
17
postinstall
17
postinstall
@ -418,29 +418,40 @@ ask_mail_config(){
|
|||||||
smtpauth=0
|
smtpauth=0
|
||||||
senderaddress=""
|
senderaddress=""
|
||||||
displayname=""
|
displayname=""
|
||||||
|
if [ -f /etc/postfix/sender_canonical_maps ]; then
|
||||||
|
senderaddress=$(grep "@" -m1 /etc/postfix/sender_canonical_maps | cut -d '<' -f2 | cut -d '>' -f1)
|
||||||
|
displayname=$(grep "@" -m1 /etc/postfix/sender_canonical_maps | cut -d' ' -f5)
|
||||||
|
fi
|
||||||
recipientaddress=""
|
recipientaddress=""
|
||||||
smtphost=$(grep relayhost /etc/postfix/main.cf | cut -d : -f1 | cut -d ' ' -f3 | cut -d ']' -f1 | cut -d '[' -f2)
|
smtphost=$(grep relayhost /etc/postfix/main.cf | cut -d : -f1 | cut -d ' ' -f3 | cut -d ']' -f1 | cut -d '[' -f2)
|
||||||
smtpport=25
|
smtpport=25
|
||||||
username=""
|
username=""
|
||||||
|
password=""
|
||||||
|
if [ -f /etc/postfix/sasl_passwd ]; then
|
||||||
|
username=$(cat /etc/postfix/sasl_passwd | cut -d ' ' -f2- | cut -d':' -f1)
|
||||||
|
password=$(cat /etc/postfix/sasl_passwd | cut -d ' ' -f2- | cut -d':' -f2-)
|
||||||
|
else
|
||||||
|
username=$senderaddress
|
||||||
|
fi
|
||||||
if whiptail --title "MAIL DELIVERY" \
|
if whiptail --title "MAIL DELIVERY" \
|
||||||
--backtitle "$PROG" \
|
--backtitle "$PROG" \
|
||||||
--yes-button "MAIL CONFIG" \
|
--yes-button "MAIL CONFIG" \
|
||||||
--no-button "SKIP" \
|
--no-button "SKIP" \
|
||||||
--yesno "Do you want to configure postfix with a smarthost?" 9 76 ; then
|
--yesno "Do you want to configure postfix with a smarthost?" 9 76 ; then
|
||||||
mailconfig=1
|
mailconfig=1
|
||||||
if ! senderaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender email address." 9 76 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
|
||||||
if ! displayname=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender display name." 9 76 $(hostname -f) 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
if ! displayname=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender display name." 9 76 $(hostname -f) 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
if ! recipientaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the email address to receive notifications." 9 76 $(pvesh get access/users/root@pam --output-format yaml| grep email | cut -d' ' -f2) 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
if ! recipientaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the email address to receive notifications." 9 76 $(pvesh get access/users/root@pam --output-format yaml| grep email | cut -d' ' -f2) 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
if ! smtphost=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the servername of your smarthost." 9 76 $smtphost 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
if ! smtphost=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the servername of your smarthost." 9 76 $smtphost 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
smtpport=$(inputbox_int 'MAIL DELIVERY' 'Please enter the port of your smarthost' 7 $(grep relayhost /etc/postfix/main.cf | cut -d':' -f2))
|
smtpport=$(inputbox_int 'MAIL DELIVERY' 'Please enter the port of your smarthost' 7 $(grep relayhost /etc/postfix/main.cf | cut -d':' -f2))
|
||||||
|
if ! senderaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender email address." 9 76 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
if whiptail --title "MAIL DELIVERY" \
|
if whiptail --title "MAIL DELIVERY" \
|
||||||
--backtitle "$PROG" \
|
--backtitle "$PROG" \
|
||||||
--yes-button "CONFIGURE AUTH" \
|
--yes-button "CONFIGURE AUTH" \
|
||||||
--no-button "SKIP" \
|
--no-button "SKIP" \
|
||||||
--yesno "Do you want to configure authentication against your smarthost?" 9 76 ; then
|
--yesno "Do you want to configure authentication against your smarthost?" 9 76 ; then
|
||||||
smtpauth=1
|
smtpauth=1
|
||||||
if ! username=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the username for authentication." 9 76 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
if ! username=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the username for authentication." 9 76 $username 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
if ! password=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --passwordbox "Please enter the passsword for authentication." 9 76 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
if ! password=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --passwordbox "Please enter the passsword for authentication." 9 76 $password 3>&1 1>&2 2>&3); then cancel_dialog; fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user