Skip to content

Commit

Permalink
Manually manage /etc/hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Oct 3, 2016
1 parent 5686b1d commit fd49498
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 8 additions & 3 deletions network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit fd49498

Please sign in to comment.