From fd494982062acb52fce87289026e76472438b6ea Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Mon, 3 Oct 2016 13:47:36 +0000 Subject: [PATCH] Manually manage /etc/hosts --- CHANGELOG.md | 5 +++++ network.sh | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83e397a..f3d66a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.4.0 (2016-10-03) + + * Change script output colour + * Manually manage /etc/hosts instead of calling sethostname + ## 1.3.0 (2016-03-24) * Add original udhcpc.script from BusyBox diff --git a/network.sh b/network.sh index b72bd7c..43fc03a 100755 --- a/network.sh +++ b/network.sh @@ -16,12 +16,17 @@ if [ -f "$config" ]; then . $config if [ "$hostname" ]; then - /usr/bin/sethostname $hostname + echo -n "${GREEN}Setting hostname to ${MAGENTA}$hostname${NORMAL}" + sed -i "/^127.0.0.1/c\127.0.0.1 $hostname localhost localhost.local" /etc/hosts + echo "$hostname" > /etc/hostname + hostname "$hostname" + echo "${GREEN} Done.${NORMAL}" fi /sbin/ifconfig $interface up - echo "${GREEN}Waiting for interface ${YELLOW}$interface${GREEN} to be up...${NORMAL}" + echo -n "${GREEN}Waiting for interface ${MAGENTA}$interface${GREEN} to be up...${NORMAL}" sleep 5 + echo "${GREEN} Done.${NORMAL}" case "$mode" in static) @@ -32,7 +37,7 @@ if [ -f "$config" ]; then ;; esac else - echo "${RED}Missing network config: ${YELLOW}${config}${NORMAL}" + echo "${RED}Missing network config: ${RED}${config}${NORMAL}" exit 1 fi