about summary refs log tree commit diff
diff options
context:
space:
mode:
authorclassabbyamp <void@placeviolette.net>2023-02-05 13:02:46 -0500
committerLeah Neukirchen <leah@vuxu.org>2023-02-07 13:28:21 +0100
commitbd44e7cec69e7a2eef88c787211e4baa906954e8 (patch)
tree01dd4db28c3722d1b3a35545b83a0f87c42dc355
parent59a9003b0dfa034abb52860bea3d568b0471d786 (diff)
downloadxtools-bd44e7cec69e7a2eef88c787211e4baa906954e8.tar.gz
xtools-bd44e7cec69e7a2eef88c787211e4baa906954e8.tar.xz
xtools-bd44e7cec69e7a2eef88c787211e4baa906954e8.zip
xmksv: add ability to create log services v0.65
-rw-r--r--README5
-rwxr-xr-xxmksv18
-rw-r--r--xtools.18
3 files changed, 26 insertions, 5 deletions
diff --git a/README b/README
index 0d7c826..ae78e4a 100644
--- a/README
+++ b/README
@@ -91,8 +91,9 @@ COMMANDS
      xmandoc manpage
         – read manpage of possibly not installed package
 
-     xmksv [newsvdir]
-        – create new runit service templates
+     xmksv [-l] [newsvdir ...]
+        – create new runit service templates. Also creates log service if -l
+        is passed.
 
      xmypkgs [email]
         – list all pkgs maintained by you
diff --git a/xmksv b/xmksv
index 619ba26..8c0a5d6 100755
--- a/xmksv
+++ b/xmksv
@@ -1,5 +1,10 @@
 #!/bin/sh -e
-# xmksv [NEWSVDIR...] - create new runit service templates
+# xmksv [-l] [NEWSVDIR...] - create new runit service templates
+
+if [ "$1" = "-l" ]; then
+	MKLOG=1
+	shift
+fi
 
 cd ${SVDIR:-/etc/sv}
 
@@ -11,4 +16,15 @@ for SRV; do
 		ln -s /run/runit/supervise."$(printf %s "$SRV" | tr / -)" \
 			"$SRV/supervise"
 	fi
+	if [ -n "$MKLOG" ]; then
+		mkdir "$SRV/log"
+		cat <<EOF | install -m755 /dev/stdin "$SRV/log/run"
+#!/bin/sh
+exec vlogger -t $SRV -f daemon
+EOF
+		if [ -w /run/runit ]; then
+			ln -s /run/runit/supervise."$(printf %s "$SRV/log" | tr / -)" \
+				"$SRV/log/supervise"
+		fi
+	fi
 done
diff --git a/xtools.1 b/xtools.1
index 185c073..7a2fb90 100644
--- a/xtools.1
+++ b/xtools.1
@@ -112,8 +112,12 @@ Sync with the official git based xlocate database, which is recommended before u
 .Nd list files contained in pkg (including binpkgs)
 .It Nm xmandoc Ar manpage
 .Nd read manpage of possibly not installed package
-.It Nm xmksv Op Ar newsvdir
-.Nd create new runit service templates
+.It Nm xmksv Oo Fl l Oc \
+Op Ar newsvdir ...
+.Nd create new runit service templates.
+Also creates log service if
+.Fl l
+is passed.
 .It Nm xmypkgs Op Ar email
 .Nd list all pkgs maintained by you
 .It Nm xnew \