Skip to content

Commit fd49498

Browse files
committed
Manually manage /etc/hosts
1 parent 5686b1d commit fd49498

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.4.0 (2016-10-03)
4+
5+
* Change script output colour
6+
* Manually manage /etc/hosts instead of calling sethostname
7+
38
## 1.3.0 (2016-03-24)
49

510
* Add original udhcpc.script from BusyBox

network.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ if [ -f "$config" ]; then
1616
. $config
1717

1818
if [ "$hostname" ]; then
19-
/usr/bin/sethostname $hostname
19+
echo -n "${GREEN}Setting hostname to ${MAGENTA}$hostname${NORMAL}"
20+
sed -i "/^127.0.0.1/c\127.0.0.1 $hostname localhost localhost.local" /etc/hosts
21+
echo "$hostname" > /etc/hostname
22+
hostname "$hostname"
23+
echo "${GREEN} Done.${NORMAL}"
2024
fi
2125

2226
/sbin/ifconfig $interface up
23-
echo "${GREEN}Waiting for interface ${YELLOW}$interface${GREEN} to be up...${NORMAL}"
27+
echo -n "${GREEN}Waiting for interface ${MAGENTA}$interface${GREEN} to be up...${NORMAL}"
2428
sleep 5
29+
echo "${GREEN} Done.${NORMAL}"
2530

2631
case "$mode" in
2732
static)
@@ -32,7 +37,7 @@ if [ -f "$config" ]; then
3237
;;
3338
esac
3439
else
35-
echo "${RED}Missing network config: ${YELLOW}${config}${NORMAL}"
40+
echo "${RED}Missing network config: ${RED}${config}${NORMAL}"
3641
exit 1
3742
fi
3843

0 commit comments

Comments
 (0)