blob: b74fb913efc2f4b63b45608c6d65847c5c4825ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/sh
case "${0}" in
/etc/network/if-*.d/*) ;;
*) exit 1;;
esac
if [ "x${IFACE}" = 'x' ]; then
exit 1
fi
get_iface_opts()
{
local opts_start_cb="${1}"
local opt_cb="${2}"
local opts_end_cb="${3}"
local script=
local opts=
local opt=
script="$(printf '
/^iface[ \\t][ \\t]*%s/,/^[^ \\t]/{
/^$/q;
s/^[ \\t][ \\t]*//p;
}
' "${IFACE}")"
opts="$(sed -n "${script}" /var/run/net-ifaces)"
if [ "x${opts}" = 'x' ]; then
return 0
fi
${opts_start_cb}
while read -r opt; do
${opt_cb} ${opt}
done <<-EOF
${opts}
EOF
${opts_end_cb}
return 0
}
|