Skip to content

Commit 7c3b418

Browse files
committed
fix_etc_hosts: Don't add 127.0.1.1 if it isn't already there
1 parent d2d4306 commit 7c3b418

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

os2borgerpc/os2borgerpc/fix_etc_hosts.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22

33
HOSTS=/etc/hosts
44

5-
sed --in-place /127.0.1.1/d $HOSTS
6-
sed --in-place "2i 127.0.1.1 $(hostname)" $HOSTS
5+
# Don't add 127.0.1.1 if it isn't already there
6+
if grep --quiet 127.0.1.1 $HOSTS; then
7+
sed --in-place /127.0.1.1/d $HOSTS
8+
sed --in-place "2i 127.0.1.1 $(hostname)" $HOSTS
9+
fi

0 commit comments

Comments
 (0)