From 54d8b12cfe5b6028b5e1152ba1627878d3657a6b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 19 Aug 2018 21:31:04 +0000 Subject: system/gettys-openrc: new package. Move all getty definitions to it. Small change to system/adelie-base so it includes gettys-openrc. Small change to system/s6 so it doesn't statically define gettys. --- system/adelie-base/APKBUILD | 4 ++-- system/gettys-openrc/APKBUILD | 23 +++++++++++++++++++++++ system/gettys-openrc/gettys.confd | 14 ++++++++++++++ system/gettys-openrc/gettys.initd | 38 ++++++++++++++++++++++++++++++++++++++ system/s6/APKBUILD | 18 ++++-------------- system/s6/agetty-run | 2 -- system/s6/s6.pre-install | 6 ------ system/s6/s6.pre-upgrade | 6 ------ 8 files changed, 81 insertions(+), 30 deletions(-) create mode 100644 system/gettys-openrc/APKBUILD create mode 100644 system/gettys-openrc/gettys.confd create mode 100644 system/gettys-openrc/gettys.initd delete mode 100644 system/s6/agetty-run delete mode 100644 system/s6/s6.pre-install delete mode 100644 system/s6/s6.pre-upgrade diff --git a/system/adelie-base/APKBUILD b/system/adelie-base/APKBUILD index 694a8bcaa..901a05ad1 100644 --- a/system/adelie-base/APKBUILD +++ b/system/adelie-base/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=adelie-base pkgver=0.8.1 -pkgrel=4 +pkgrel=5 pkgdesc="The Adélie Linux Base System" url="http://adelielinux.org/" arch="noarch" @@ -14,7 +14,7 @@ _core_depends="apk-tools adelie-keys shadow sysklogd patch sed nvi psmisc less" depends="adelie-core debianutils libarchive-tools file zsh binutils - console-setup sysklogd man-db tzdata" + console-setup sysklogd man-db tzdata gettys-openrc" makedepends="" makedepends_host="$depends" install="" 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 +# Maintainer: Laurent Bercot +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 +} diff --git a/system/s6/APKBUILD b/system/s6/APKBUILD index a08220a3e..658a0d7ed 100644 --- a/system/s6/APKBUILD +++ b/system/s6/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Laurent Bercot pkgname=s6 pkgver=2.7.2.0 -pkgrel=2 +pkgrel=3 pkgdesc="skarnet.org's small & secure supervision software suite" url="https://skarnet.org/software/$pkgname/" arch="all" @@ -10,11 +10,11 @@ options="!check" # No test suite. license="ISC" depends_dev="skalibs-dev execline-dev" makedepends="skalibs-dev>=2.7 execline-dev" -install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade" +install="$pkgname.post-upgrade" subpackages="$pkgname-dev $pkgname-doc" triggers="$pkgname.trigger=/run/service" source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz - s6-svscanboot agetty-run" + s6-svscanboot" build() { @@ -35,15 +35,6 @@ package() { cp -f "$srcdir/s6-svscanboot" "$pkgdir/lib/s6/s6-svscanboot" mkdir -p -m 0755 "$pkgdir/etc/s6/early-services" "$pkgdir/var/lib/s6/services" chmod 0755 "$pkgdir/lib/s6/s6-svscanboot" - - - # The getty scripts are created here - - for i in 1 2 3 4 5 6 ; do - mkdir -m 0755 "$pkgdir/etc/s6/early-services/getty-$i" - sed -e "s/%TTY%/tty$i/g" < "$srcdir/agetty-run" > "$pkgdir/etc/s6/early-services/getty-$i/run" - chmod 0755 "$pkgdir/etc/s6/early-services/getty-$i/run" - done } doc() { @@ -53,5 +44,4 @@ doc() { } sha512sums="0ab98c44324054effa0754efd117b3126a53fac7096979aacffd7d86128c5cb1f714205e30ca4e561ca3740646d1f36eb53b9e30d139d7ce4dc1b8cfb3e33123 s6-2.7.2.0.tar.gz -bad19965aa8ea138cdf5688db9ae05fc7ce2111ac0945b5b0e78cda55ad290602f28ac8b52aae395ca5e857f32e9be4d6df882286b362ba7008a52b29472ff1e s6-svscanboot -fb60b841da03583ba9f0f0541b45e4cf88fa5311b26376042e951317428dcaa6c81bb6c739c7a442ef0d36e1581a29cb9c4fb2d87411268fb23a033130fc8051 agetty-run" +bad19965aa8ea138cdf5688db9ae05fc7ce2111ac0945b5b0e78cda55ad290602f28ac8b52aae395ca5e857f32e9be4d6df882286b362ba7008a52b29472ff1e s6-svscanboot" diff --git a/system/s6/agetty-run b/system/s6/agetty-run deleted file mode 100644 index 79884efc7..000000000 --- a/system/s6/agetty-run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/execlineb -P -/sbin/agetty 38400 %TTY% linux diff --git a/system/s6/s6.pre-install b/system/s6/s6.pre-install deleted file mode 100644 index 2c175a325..000000000 --- a/system/s6/s6.pre-install +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -addgroup -S catchlog 2>/dev/null -adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null - -exit 0 diff --git a/system/s6/s6.pre-upgrade b/system/s6/s6.pre-upgrade deleted file mode 100644 index 2c175a325..000000000 --- a/system/s6/s6.pre-upgrade +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -addgroup -S catchlog 2>/dev/null -adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null - -exit 0 -- cgit v1.2.3-70-g09d2