summaryrefslogtreecommitdiffstats
path: root/uninstall.lexd_spool.sh
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2026-08-22 10:41:25 +0800
committerSadeep Madurange <sadeep@asciimx.com>2026-08-22 10:41:25 +0800
commit1458b2b562bb0d2e0328bae45480bbbb635b71f2 (patch)
treedac47d9b18bac1f23cad3471c938afca9c899fa9 /uninstall.lexd_spool.sh
parent0682cf927984628bcae3e6bcbff7022ae5ff0aa6 (diff)
downloadlex-1458b2b562bb0d2e0328bae45480bbbb635b71f2.tar.gz
Install scripts, run file for spool processor.
Diffstat (limited to 'uninstall.lexd_spool.sh')
-rw-r--r--uninstall.lexd_spool.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/uninstall.lexd_spool.sh b/uninstall.lexd_spool.sh
new file mode 100644
index 0000000..39a863a
--- /dev/null
+++ b/uninstall.lexd_spool.sh
@@ -0,0 +1,46 @@
+#!/bin/ksh
+#
+# uninstall.lexd_spool.sh - remove lexd-spool binary and rc.d script.
+#
+# Usage: doas ./uninstall.lexd_spool.sh
+
+set -e
+
+BIN_DST="/usr/local/bin/lexd-spool"
+RC_DST="/etc/rc.d/lexd_spool"
+SERVICE="lexd_spool"
+
+if [ "$(id -u)" -ne 0 ]; then
+ echo "error: this script must be run as root" >&2
+ exit 1
+fi
+
+# stop the service if it's running
+if [ -e "$RC_DST" ] && rcctl check "$SERVICE" >/dev/null 2>&1; then
+ echo "stopping $SERVICE"
+ rcctl stop "$SERVICE"
+fi
+
+# disable the service if it's enabled
+if [ -e "$RC_DST" ] && rcctl ls on | grep -qx "$SERVICE"; then
+ echo "disabling $SERVICE"
+ rcctl disable "$SERVICE"
+fi
+
+# remove the rc.d script
+if [ -e "$RC_DST" ]; then
+ echo "removing $RC_DST"
+ rm -f "$RC_DST"
+else
+ echo "$RC_DST not present, skipping"
+fi
+
+# remove the binary
+if [ -e "$BIN_DST" ]; then
+ echo "removing $BIN_DST"
+ rm -f "$BIN_DST"
+else
+ echo "$BIN_DST not present, skipping"
+fi
+
+echo "done."