packages/net/wg-installer/wg-server/hotplug.d/99-mesh-olsrd
Nick Hainke 69c81790d1 wg-installer: rework code
Use shellcheck to rework the code. Use "export" to return variables from
a function call. Further, fix typos.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-01-20 02:04:50 +01:00

20 lines
405 B
Bash

#!/bin/sh
# check if wireguard
if [ "${DEVTYPE}" != "wireguard" ]; then
exit 0
fi
# check if correct naming
slicedint=$(echo "$INTERFACE" | cut -c1-3)
if [ "${slicedint}" != "wg_" ]; then
exit 0
fi
if [ "${ACTION}" = "add" ]; then
ubus call olsrd add_interface '{"ifname":'\""$INTERFACE"\"'}'
fi
if [ "${ACTION}" = "remove" ]; then
ubus call olsrd del_interface '{"ifname":'\""$INTERFACE"\"'}'
fi