From ac74c13e94287525caaa6738a8c29bfef41c3b84 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 1 Sep 2014 12:52:58 +0530 Subject: [PATCH] Added FQDN check --- bin/install | 19 +++++++++++++++++++ bin/update | 3 +++ src/lib/ee_lib_check_fqdn.sh | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/lib/ee_lib_check_fqdn.sh diff --git a/bin/install b/bin/install index 980ded4a..a752a326 100644 --- a/bin/install +++ b/bin/install @@ -81,6 +81,23 @@ function ee_lib_package_check() done } +# Check hostname is FQDN or not. If not set it +function ee_lib_check_fqdn() +{ + case $1 in + *.*) + if [ $EE_FQDN != "" ];then + echo $EE_FQDN > /etc/hostname + service hostname restart &>> $EE_INSTALL_LOG + hostname -f &>> $EE_INSTALL_LOG + fi + ;; + *) + read -p "Enter FQDN to set for Hostname: " EE_FQDN + ee_lib_check_fqdn $EE_FQDN + ;; + esac +} # Pre checks to avoid later screw ups # Checking EasyEngine (ee) log directory @@ -184,6 +201,8 @@ fi cp -a /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_INSTALL_LOG \ || ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $? +# Make hostname as FQDN +ee_lib_check_fqdn $(hostname -f) # Git config settings GIT_USER_NAME=$(git config user.name) diff --git a/bin/update b/bin/update index c719cdda..55ec38a0 100644 --- a/bin/update +++ b/bin/update @@ -395,6 +395,9 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then done fi + # Make hostname as FQDN + ee_lib_check_fqdn $(hostname -f) + if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then diff --git a/src/lib/ee_lib_check_fqdn.sh b/src/lib/ee_lib_check_fqdn.sh new file mode 100644 index 00000000..8639d523 --- /dev/null +++ b/src/lib/ee_lib_check_fqdn.sh @@ -0,0 +1,18 @@ +# Check Server hostname is FQDN or not + +function ee_lib_check_fqdn() +{ + case $1 in + *.*) + if [ $EE_FQDN != "" ];then + echo $EE_FQDN > /etc/hostname + service hostname restart &>> $EE_COMMAND_LOG + hostname -f &>> $EE_COMMAND_LOG + fi + ;; + *) + read -p "Enter FQDN to set for Hostname: " EE_FQDN + ee_lib_check_fqdn $EE_FQDN + ;; + esac +}