Duplicated entry in /etc/hosts

This commit is contained in:
Bob Motram 2015-03-02 20:54:19 +00:00
parent 4181356aa1
commit cf0011c11c
1 changed files with 6 additions and 3 deletions

View File

@ -4396,8 +4396,11 @@ function set_your_domain_name {
fi
echo "$DEFAULT_DOMAIN_NAME" > /etc/hostname
hostname $DEFAULT_DOMAIN_NAME
if grep -q "127.0.1.1" /etc/hosts; then
sed -i "s/127.0.1.1.*/127.0.1.1 $DEFAULT_DOMAIN_NAME/g" /etc/hosts
else
echo "127.0.1.1 $DEFAULT_DOMAIN_NAME" >> /etc/hosts
fi
echo 'set_your_domain_name' >> $COMPLETION_FILE
}