Fix /etc/hosts add

This commit is contained in:
Edi Septriyanto
2022-02-17 08:14:52 +07:00
parent 0d6e83b98f
commit dc7766a093

View File

@@ -508,6 +508,7 @@ function preflight_system_check() {
if grep -q "${SERVER_HOSTNAME}" /etc/hosts; then
run sed -i".bak" "/${SERVER_HOSTNAME}/d" /etc/hosts
run bash -c "echo -e '${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts"
else
run bash -c "echo -e '\n# LEMPer local hosts\n${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts"
fi
@@ -528,8 +529,8 @@ function preflight_system_check() {
# Check if the hostname is pointed to server IP address.
if [[ $(dig "${HOSTNAME}" +short) != "${SERVER_IP}" && $(dig "${HOSTNAME}" +short) != "${SERVER_IP_LOCAL}" ]]; then
error "It seems that your server's hostname '${HOSTNAME}' is not yet pointed to your server's IP address."
echo -n "In production environment you should add an A record and points it to this server IP address "; status -n "${SERVER_IP}"; echo " !"
error "It seems that your server's hostname '${HOSTNAME}' is not yet pointed to your server's public IP address."
echo -n "In production environment you need to add an A record and point it to this IP address "; status -n "${SERVER_IP}"; echo " !"
exit 1
fi
fi