aboutsummaryrefslogtreecommitdiff
path: root/container/stop
diff options
context:
space:
mode:
Diffstat (limited to 'container/stop')
-rwxr-xr-xcontainer/stop20
1 files changed, 20 insertions, 0 deletions
diff --git a/container/stop b/container/stop
new file mode 100755
index 0000000..9affb9c
--- /dev/null
+++ b/container/stop
@@ -0,0 +1,20 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-3.0-only
+# SPDX-FileCopyrightText: 2026 Nicholas Rodrigues Lordello <[email protected]>
+
+if [ "$(id -u)" -ne 0 ]; then
+ printf '%s: operation not permitted\n' "$0" >&2
+ exit 1
+fi
+
+if [ -x /etc/dbx/stop.local ]; then
+ /etc/dbx/stop.local ||
+ printf '%s: stop.local failed (%d)\n' "$0" "$?" >&2
+fi
+
+if ! pid="$(cat /run/dbx.pid)"; then
+ printf '%s: could not read init PID file, assuming 1\n' "$0" >&2
+ pid=1
+fi
+kill -TERM "$pid" ||
+ printf '%s: could not stop init[%s] (%d)\n' "$0" "$pid" "$?" >&2