executors: add dhcp executor (replacing the built in)
This commit is contained in:
parent
dca34ebba7
commit
cf8ae46ca0
1 changed files with 40 additions and 0 deletions
40
executors/dhcp
Executable file
40
executors/dhcp
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
determine_implementation() {
|
||||||
|
[ -x /sbin/udhcpc ] && echo "udhcpc" && return
|
||||||
|
echo "???"
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
case "$1" in
|
||||||
|
udhcpc)
|
||||||
|
/sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "implementation $1 not supported"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
case "$1" in
|
||||||
|
udhcpc)
|
||||||
|
kill $(cat /var/lib/udhcpc.$IFACE.pid)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "implementation $1 not supported"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
impl=$(determine_implementation)
|
||||||
|
|
||||||
|
[ -z "$VERBOSE" ] || set -x
|
||||||
|
|
||||||
|
case "$MODE" in
|
||||||
|
start) start $impl ;;
|
||||||
|
stop) stop $impl ;;
|
||||||
|
*) echo "unknown mode $MODE" ;;
|
||||||
|
esac
|
Loading…
Reference in a new issue