aboutsummaryrefslogtreecommitdiff
path: root/core/baselayout/files
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-02-16 15:19:38 +0300
committerCem Keylan <cem@ckyln.com>2021-02-16 15:19:38 +0300
commita24f617e22453a8aef55ba4f717c35ab83b8d85b (patch)
tree0a250ed67a0f7c67950ffae702d841f75fd90d53 /core/baselayout/files
parent4c911934329ee90fbb29657af4d53c6a1fad8ac7 (diff)
downloadrepository-a24f617e22453a8aef55ba4f717c35ab83b8d85b.tar.gz
baselayout: bump to 2
Diffstat (limited to 'core/baselayout/files')
-rwxr-xr-xcore/baselayout/files/install-sv34
1 files changed, 34 insertions, 0 deletions
diff --git a/core/baselayout/files/install-sv b/core/baselayout/files/install-sv
new file mode 100755
index 00000000..509b2516
--- /dev/null
+++ b/core/baselayout/files/install-sv
@@ -0,0 +1,34 @@
+#!/bin/sh -e
+# Carbs Linux service installer
+
+usage() {
+ printf '%s\n' \
+ "usage: ${0##*/} [FILE...]" \
+ "or: ${0##*/} [-a NAME FILE]" "" \
+ "You can set the DESTDIR environment variable to set a different root."
+ exit 1
+}
+
+svname=''
+case "$1" in
+ --help|-h|'') usage ;;
+ -a) [ "$#" -eq 3 ] || usage
+ svname=$2; shift 2
+esac
+
+for service; do
+ # Remove .run suffix and the directory name for service files.
+ sv=${svname:-${service%.run}} sv=${sv##*/}
+
+ # Create the service directories and copy the service file to them.
+ mkdir -p "$DESTDIR/etc/sysmgr" "$DESTDIR/etc/sv/$sv"
+ cp "$service" "$DESTDIR/etc/sysmgr/$sv"
+ cp "$service" "$DESTDIR/etc/sv/$sv/run"
+
+ # Set permissions for the services.
+ chmod 0755 "$DESTDIR/etc/sysmgr/$sv" "$DESTDIR/etc/sv/$sv/run"
+
+ # Create supervise directories for runit.
+ ln -s "/run/runit/supervise.$sv" "$DESTDIR/etc/sv/$sv/supervise"
+
+done