Skip to content
Snippets Groups Projects
Commit 55e89610 authored by Martine Lenders's avatar Martine Lenders
Browse files

tools: ethos: allow `start_network.sh` script to run from anywhere

parent 5d65d59b
Branches
No related tags found
No related merge requests found
#!/bin/sh
ETHOS_DIR="$(dirname $(readlink -f $0))"
create_tap() {
ip tuntap add ${TAP} mode tap user ${USER}
sysctl -w net.ipv6.conf.${TAP}.forwarding=1
......@@ -18,7 +20,7 @@ cleanup() {
echo "Cleaning up..."
remove_tap
ip a d fd00:dead:beef::1/128 dev lo
kill $UHCPD_PID
kill ${UHCPD_PID}
trap "" INT QUIT TERM EXIT
}
......@@ -30,13 +32,14 @@ start_uhcpd() {
PORT=$1
TAP=$2
PREFIX=$3
UHCPD=../uhcpd/bin/uhcpd
UHCPD="$(readlink -f "${ETHOS_DIR}/../uhcpd/bin")/uhcpd"
[ -z "$PORT" -o -z "$TAP" -o -z "$PREFIX" ] && {
[ -z "${PORT}" -o -z "${TAP}" -o -z "${PREFIX}" ] && {
echo "usage: $0 <serial-port> <tap-device> <prefix>"
exit 1
}
trap "cleanup" INT QUIT TERM EXIT
create_tap && start_uhcpd && ./ethos $TAP $PORT
create_tap && start_uhcpd && "${ETHOS_DIR}/ethos" ${TAP} ${PORT}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment