diff --git a/setupninja.sh b/setupninja.sh index a8f101e..c5f40ca 100644 --- a/setupninja.sh +++ b/setupninja.sh @@ -2,7 +2,7 @@ #SETTINGS passlen=22 -emailforle="putyouremailaddresshere@domain.com" +emailforle="" #FUNCTIONS function errorcheck { @@ -92,6 +92,13 @@ function gathersettings { echo "IP address is $ipaddress..." echo -n "What is the FQDN for the server? " read fqdn + echo -n "Do you want to configure the system hostname the same as the FQDN? (y/n)" + read reply + if [[ $reply == "y" ]]; then + sethost=true + else + sethost=false + fi echo -n "Must an SLL certificate be used? (y/n)" read reply if [[ $reply == "y" ]]; then @@ -144,6 +151,9 @@ function gathersettings { if [[ $mailfrom == "" ]]; then mailfrom=$mailuser fi + if [[ $emailforle == "" ]]; then + emailforle=$mailfrom + fi echo -n "What is the sender name for the mailserver? " read mailname echo @@ -218,13 +228,15 @@ function applysettings { function sethostname { #SETTING UP HOSTNAME - echo "Setting up hostname..." - hostnamectl set-hostname ${fqdn%%.*} > /dev/null 2>&1 - errorcheck $? "define hostname" "EXIT" - echo "$ipaddress $fqdn ${fqdn%%.*}" >> /etc/hosts - errorcheck $? "define FQDN" "EXIT" - echo "1" > "$origpath/setupninja.step" - echo + if [[ $sethost == true ]]; then + echo "Setting up hostname..." + hostnamectl set-hostname ${fqdn%%.*} > /dev/null 2>&1 + errorcheck $? "define hostname" "EXIT" + echo "$ipaddress $fqdn ${fqdn%%.*}" >> /etc/hosts + errorcheck $? "define FQDN" "EXIT" + echo "1" > "$origpath/setupninja.step" + echo + fi } function initsetup {