summaryrefslogtreecommitdiffstats
path: root/install.lexd_spool.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install.lexd_spool.sh')
-rw-r--r--install.lexd_spool.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/install.lexd_spool.sh b/install.lexd_spool.sh
new file mode 100644
index 0000000..e613c5d
--- /dev/null
+++ b/install.lexd_spool.sh
@@ -0,0 +1,43 @@
+#!/bin/ksh
+#
+# install.lexd_spool.sh - install lexd-spool binary and rc.d script.
+#
+# Usage: doas ./install.lexd_spool.sh
+
+set -e
+
+BIN_SRC="./lexd-spool.sh"
+BIN_DST="/usr/local/bin/lexd-spool"
+RC_SRC="./lexd-spool.rc"
+RC_DST="/etc/rc.d/lexd_spool"
+
+if [ "$(id -u)" -ne 0 ]; then
+ echo "error: this script must be run as root" >&2
+ exit 1
+fi
+
+if [ ! -f "$BIN_SRC" ]; then
+ echo "error: $BIN_SRC not found" >&2
+ exit 1
+fi
+
+if [ ! -f "$RC_SRC" ]; then
+ echo "error: $RC_SRC not found" >&2
+ exit 1
+fi
+
+if [ ! -e "$BIN_DST" ]; then
+ echo "installing $BIN_DST"
+ install -o root -g wheel -m 0755 "$BIN_SRC" "$BIN_DST"
+else
+ echo "$BIN_DST already exists, skipping"
+fi
+
+if [ ! -e "$RC_DST" ]; then
+ echo "installing $RC_DST"
+ install -o root -g wheel -m 0555 "$RC_SRC" "$RC_DST"
+else
+ echo "$RC_DST already exists, skipping"
+fi
+
+echo "done."