blob: 66df88c7c91e9a2ff60317277b7953088fad613d [file] [log] [blame]
Václav Kubernátd1beedc2020-09-07 12:09:05 +02001set -eux
2
3if [[ $(dirname "$(dirname "$(realpath "$SYSREPO_REPOSITORY_PATH")")") != "@CMAKE_CURRENT_BINARY_DIR@" ]]; then
4 echo "\$SYSREPO_REPOSITORY_PATH is not inside the build dir! Aborting. ($SYSREPO_REPOSITORY_PATH)"
5 exit 1
6fi
7
8if [[ -z "$SYSREPO_SHM_PREFIX" ]]; then
9 echo '$SYSREPO_SHM_PREFIX is empty! Aborting.'
10 exit 1
11fi
12
13BACKEND="$1"
14shift
15if [[ "$BACKEND" = "netconf" ]]; then
16 # The `-f` argument is neccessary so that pkill matches the whole command
17 # line, including stuff set by `exec -a`. Otherwise it matches the name in
18 # /proc/{pid}/stat and that is usually limited to 15 characters, so
19 # netopeer2-server appears as netopeer2-serve
20 pkill -f "${SYSREPO_SHM_PREFIX}_netopeer2-server"
21 rm "$NETOPEER_SOCKET"
22fi
23
24rm -r "$SYSREPO_REPOSITORY_PATH"
25rm "/dev/shm/$SYSREPO_SHM_PREFIX"*