#!/bin/sh
#Copyright: 2026 Aitor <aitor@genuen.org>
#License: CC0-1.0
#Comment: oneshot; invoke with: sv once killprocs

exec 2>&1

ebegin() { [ "${VERBOSE:-}" = no ] || echo "$@"; }
eend() { r=${1:-0}; shift || true; [ "$r" -eq 0 ] || [ "${VERBOSE:-}" = no ] || echo "$*" >&2; return "$r"; }
einfo() { [ "${VERBOSE:-}" = no ] || echo "$@"; }
ewarn() { echo "$@" >&2; }
eerror() { echo "$@" >&2; }

sv once mountall.sh || exit 1

. /lib/init/vars.sh
ebegin "Sending processes the TERM signal"
killall5 -15
eend 0
for seq in 1 2 3 4 5 6 7 8 9 10; do
	if killall5 -18; then
		:
	else
		exit 0
	fi
	sleep 1
done
ebegin "Sending processes the KILL signal"
killall5 -9
eend 0
exit 0
