build: install executor scripts

This commit is contained in:
Ariadne Conill 2020-07-25 02:55:09 -06:00
parent 7eeb7c98b5
commit c51c9f7103
2 changed files with 5 additions and 0 deletions

40
executor-scripts/dhcp Executable file
View 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