aboutsummaryrefslogtreecommitdiff
path: root/core/sinit/files
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-01-13 23:13:19 +0300
committerCem Keylan <cem@ckyln.com>2020-01-13 23:13:19 +0300
commit3e90bcf9811dd3dc5d397fbfe18d0ed84a4fac65 (patch)
treee181ca1b4ed5e5b38c0d17da89b259860798d3c1 /core/sinit/files
parent11b53c25d767fa16671bc0b42158e61c7a2de19f (diff)
downloadrepository-3e90bcf9811dd3dc5d397fbfe18d0ed84a4fac65.tar.gz
repository: move ubase and sinit to core
Diffstat (limited to 'core/sinit/files')
-rw-r--r--core/sinit/files/config.h3
-rw-r--r--core/sinit/files/poweroff3
-rw-r--r--core/sinit/files/reboot2
-rw-r--r--core/sinit/files/sinit-launch-services.boot14
-rw-r--r--core/sinit/files/sinit.post.shutdown16
-rw-r--r--core/sinit/files/sinit.pre.shutdown10
6 files changed, 48 insertions, 0 deletions
diff --git a/core/sinit/files/config.h b/core/sinit/files/config.h
new file mode 100644
index 00000000..dca21e3f
--- /dev/null
+++ b/core/sinit/files/config.h
@@ -0,0 +1,3 @@
+static char *const rcinitcmd[] = { "/usr/lib/init/rc.boot", NULL };
+static char *const rcrebootcmd[] = { "/usr/lib/init/rc.shutdown", "reboot", NULL };
+static char *const rcpoweroffcmd[] = { "/usr/lib/init/rc.shutdown", "poweroff", NULL };
diff --git a/core/sinit/files/poweroff b/core/sinit/files/poweroff
new file mode 100644
index 00000000..69e8f9a4
--- /dev/null
+++ b/core/sinit/files/poweroff
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/bin/kill -s USR1 1
diff --git a/core/sinit/files/reboot b/core/sinit/files/reboot
new file mode 100644
index 00000000..266afb92
--- /dev/null
+++ b/core/sinit/files/reboot
@@ -0,0 +1,2 @@
+#!/bin/sh
+/bin/kill -s INT 1
diff --git a/core/sinit/files/sinit-launch-services.boot b/core/sinit/files/sinit-launch-services.boot
new file mode 100644
index 00000000..4d4fad6a
--- /dev/null
+++ b/core/sinit/files/sinit-launch-services.boot
@@ -0,0 +1,14 @@
+# we are going to start runit and getty here
+
+sinit_run_getty() {
+ for getty in 1 2 3 4 5 6; do
+ ubase-box respawn /sbin/getty 38400 tty${getty} 2>&1 &
+ done
+}
+
+sinit_runit() {
+ ubase-box respawn /usr/bin/runsvdir -P /var/service &
+}
+
+[ "$SINIT_ENABLE_GETTY" = 1 ] && sinit_run_getty
+[ "$SINIT_ENABLE_RUNIT" = 1 ] && sinit_runit
diff --git a/core/sinit/files/sinit.post.shutdown b/core/sinit/files/sinit.post.shutdown
new file mode 100644
index 00000000..16deba74
--- /dev/null
+++ b/core/sinit/files/sinit.post.shutdown
@@ -0,0 +1,16 @@
+# vim:filetype=sh
+
+# We handle the shutdown from here
+
+if [ "$SINIT_SHUTDOWN_HOOKS" = 1 ]; then
+ case "$1" in
+ reboot)
+ out "Requesting system reboot..."
+ /usr/bin/ubase-box halt -r
+ ;;
+ poweroff)
+ out "Requesting system poweroff..."
+ /usr/bin/ubase-box halt -p
+ ;;
+ esac
+fi
diff --git a/core/sinit/files/sinit.pre.shutdown b/core/sinit/files/sinit.pre.shutdown
new file mode 100644
index 00000000..af0d6f4f
--- /dev/null
+++ b/core/sinit/files/sinit.pre.shutdown
@@ -0,0 +1,10 @@
+if [ "$SINIT_SHUTDOWN_HOOKS" = 1 ]; then
+ case "$1" in
+ reboot|poweroff)
+ ;;
+ *)
+ echo "Invalid action '$1' for rc.shutdown" 1>&2
+ exit 1
+ ;;
+ esac
+fi