setup: Write /etc/hosts in initscript

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2018-06-25 11:08:04 +01:00
parent d97ba75fe5
commit fd52e82a72
2 changed files with 15 additions and 63 deletions

View File

@@ -22,6 +22,18 @@ write_resolv_conf() {
) > /etc/resolv.conf
}
write_hosts() {
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
(
echo "127.0.0.1 localhost.localdomain localhost"
if [ -n "${GREEN_ADDRESS}" ]; then
echo "${GREEN_ADDRESS} ${HOSTNAME}.${DOMAINNAME} ${HOSTNAME}"
fi
) > /etc/hosts
}
case "${1}" in
start)
eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
@@ -40,6 +52,9 @@ case "${1}" in
evaluate_retval
fi
# Update hosts
write_hosts
# Update resolv.conf
write_resolv_conf
;;