21 lines
645 B
Bash
21 lines
645 B
Bash
#!/bin/sh
|
|
|
|
# After it finishes configuring a network interface, dhcpcd will write
|
|
# `online` to the `/run/dhcpcd/wait-online` pipe, if it exists.
|
|
# Reading from the pipe will block until something is written to it,
|
|
# allowing us to wait for the network to be configured, without
|
|
# repeatedly polling interface information.
|
|
#
|
|
# If anything but `online` is read from the pipe, we assume that there
|
|
# was an error configuring the network.
|
|
|
|
cleanup() {
|
|
rm -f /run/dhcpcd/wait-online
|
|
}
|
|
|
|
mkdir -p /run/dhcpcd
|
|
mkfifo /run/dhcpcd/wait-online || exit $?
|
|
trap cleanup INT TERM QUIT EXIT
|
|
status=$(cat /run/dhcpcd/wait-online)
|
|
test "${status}" = online
|