summaryrefslogtreecommitdiff
path: root/system/gettys-openrc
diff options
context:
space:
mode:
Diffstat (limited to 'system/gettys-openrc')
-rw-r--r--system/gettys-openrc/APKBUILD23
-rw-r--r--system/gettys-openrc/gettys.confd14
-rw-r--r--system/gettys-openrc/gettys.initd38
3 files changed, 75 insertions, 0 deletions
diff --git a/system/gettys-openrc/APKBUILD b/system/gettys-openrc/APKBUILD
new file mode 100644
index 000000000..5516ff0b8
--- /dev/null
+++ b/system/gettys-openrc/APKBUILD
@@ -0,0 +1,23 @@
+# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
+# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
+pkgname=gettys-openrc
+pkgver=0.0.1.0
+pkgrel=3
+pkgdesc="Dynamic getty services"
+url="http://adelielinux.org/"
+arch="noarch"
+options="!check" # No test suite.
+license="NCSA"
+depends="sysvinit execline"
+source="gettys.confd gettys.initd"
+
+package() {
+ mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d "$pkgdir"/etc/runlevels/sysinit
+ cp -f "$srcdir"/gettys.confd "$pkgdir"/etc/conf.d/gettys
+ cp -f "$srcdir"/gettys.initd "$pkgdir"/etc/init.d/gettys
+ chmod 0755 "$pkgdir"/etc/init.d/gettys
+ ln -sf ../../init.d/gettys "$pkgdir"/etc/runlevels/sysinit
+}
+
+sha512sums="feea93da30871754027bc16a7bb8687b4c1780fe7ec9a49c8479ccade4c8770a76c1638029145e33c3a170ccad2d5297287cf59cea67aa561454a333ccf6ae76 gettys.confd
+3b4c212bba04c2a100b2e48cbbcdf561f77cb1f4e0565b8d6304315e8edce54ec7891dafc7e82fe9d30a8fad7249e8f0e337f71c4ad8ec50cc140a4e5130648f gettys.initd"
diff --git a/system/gettys-openrc/gettys.confd b/system/gettys-openrc/gettys.confd
new file mode 100644
index 000000000..910954cdd
--- /dev/null
+++ b/system/gettys-openrc/gettys.confd
@@ -0,0 +1,14 @@
+# Set to the list of devices you want to spawn a getty on if the device exists
+
+GETTYS="tty1 tty2 tty3 tty4 tty5 tty6 hvc0 ttyS0"
+
+
+# For every tty defined here, fill agetty options and baud rate if applicable
+
+GETTYS_hvc0_OPTIONS="-L"
+
+GETTYS_ttyS0_OPTIONS="-8 -h"
+GETTYS_ttyS0_BAUDRATE="115200"
+
+GETTYS_ttyS1_OPTIONS="-8 -h"
+GETTYS_ttyS1_BAUDRATE="115200"
diff --git a/system/gettys-openrc/gettys.initd b/system/gettys-openrc/gettys.initd
new file mode 100644
index 000000000..cf74b0e8a
--- /dev/null
+++ b/system/gettys-openrc/gettys.initd
@@ -0,0 +1,38 @@
+#!/sbin/openrc-run
+
+description="Create s6 services for gettys on user-chosen terminals"
+
+depend() {
+ after dev-mount
+}
+
+makeservice() {
+ set -e
+ tty="$1"
+ eval 'options="$GETTYS_'"$tty"'_OPTIONS"'
+ eval 'baud="$GETTYS_'"$tty"'_BAUDRATE"'
+ if test -z "$baud" ; then
+ baud=38400
+ fi
+ mkdir -p -m 0755 "/run/early-services/getty-$tty"
+ {
+ echo '#!/bin/execlineb -P'
+ echo
+ echo "/sbin/agetty $options -- $baud $tty linux"
+ } > "/run/early-services/getty-$tty/run"
+ chmod 0755 "/run/early-services/getty-$tty/run"
+}
+
+start()
+{
+ set -e
+ mkdir -m 0755 -p /run/early-services
+ . /etc/conf.d/gettys
+ for i in $GETTYS ; do
+ if test -c /dev/"$i" ; then
+ ebegin "Creating getty service for $i"
+ makeservice "$i"
+ eend $?
+ fi
+ done
+}