blob: 66df88c7c91e9a2ff60317277b7953088fad613d [file] [log] [blame]
set -eux
if [[ $(dirname "$(dirname "$(realpath "$SYSREPO_REPOSITORY_PATH")")") != "@CMAKE_CURRENT_BINARY_DIR@" ]]; then
echo "\$SYSREPO_REPOSITORY_PATH is not inside the build dir! Aborting. ($SYSREPO_REPOSITORY_PATH)"
exit 1
fi
if [[ -z "$SYSREPO_SHM_PREFIX" ]]; then
echo '$SYSREPO_SHM_PREFIX is empty! Aborting.'
exit 1
fi
BACKEND="$1"
shift
if [[ "$BACKEND" = "netconf" ]]; then
# The `-f` argument is neccessary so that pkill matches the whole command
# line, including stuff set by `exec -a`. Otherwise it matches the name in
# /proc/{pid}/stat and that is usually limited to 15 characters, so
# netopeer2-server appears as netopeer2-serve
pkill -f "${SYSREPO_SHM_PREFIX}_netopeer2-server"
rm "$NETOPEER_SOCKET"
fi
rm -r "$SYSREPO_REPOSITORY_PATH"
rm "/dev/shm/$SYSREPO_SHM_PREFIX"*