Skip to content

Commit

Permalink
Merge pull request #28 from balena-io-experimental/kyle/resolve-local…
Browse files Browse the repository at this point in the history
…host

Add localhost to /etc/hosts if missing
  • Loading branch information
flowzone-app[bot] authored Nov 7, 2023
2 parents a468fad + 1a030e4 commit 6f14eac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions overlay/sbin/init
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ if ! mountpoint -q /sys/fs/cgroup; then
mount -t cgroup cgroup /sys/fs/cgroup
fi

if ! grep -q localhost /etc/hosts; then
echo "127.0.0.1 localhost" >>/etc/hosts
fi

if [ -f /etc/profile ]; then
# shellcheck disable=SC1091
. /etc/profile || true
Expand Down
1 change: 1 addition & 0 deletions test/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if command -v npm >/dev/null 2>&1; then
fi

if command -v ping >/dev/null 2>&1; then
ping -c 1 "localhost"
ping -c 1 "$(ip route | awk '/default/ {print $3}')"
ping -c 1 "$(head -1 /etc/resolv.conf | awk '{print $2}')"
ping -c 1 -M "do" -s 1472 "$(head -1 /etc/resolv.conf | awk '{print $2}')"
Expand Down

0 comments on commit 6f14eac

Please sign in to comment.