summaryrefslogtreecommitdiff
path: root/system/utmps
diff options
context:
space:
mode:
Diffstat (limited to 'system/utmps')
-rw-r--r--system/utmps/APKBUILD30
-rw-r--r--system/utmps/utmpd.run2
-rw-r--r--system/utmps/utmps.initd32
-rw-r--r--system/utmps/utmps.post-upgrade3
-rw-r--r--system/utmps/utmps.pre-install1
-rw-r--r--system/utmps/utmps.pre-upgrade1
-rw-r--r--system/utmps/wtmpd.run2
7 files changed, 18 insertions, 53 deletions
diff --git a/system/utmps/APKBUILD b/system/utmps/APKBUILD
index 01ac5356e..803097314 100644
--- a/system/utmps/APKBUILD
+++ b/system/utmps/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=utmps
pkgver=0.0.1.2
-pkgrel=0
+pkgrel=2
pkgdesc="A secure utmp/wtmp implementation"
url="https://skarnet.org/software/$pkgname/"
arch="all"
@@ -11,10 +11,9 @@ license="ISC"
depends="execline s6"
depends_dev="skalibs-dev"
makedepends="skalibs-dev"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
-install="$pkgname.pre-install $pkgname.pre-upgrade"
+subpackages="$pkgname-dev $pkgname-doc"
+install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz
- $pkgname.initd
utmpd.run
wtmpd.run"
@@ -33,18 +32,12 @@ build() {
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
- mkdir -p "$pkgdir/etc/init.d" "$pkgdir/var/lib/$pkgname/services/utmpd" "$pkgdir/var/lib/$pkgname/services/wtmpd"
- cp -f "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
- cp -f "$srcdir/utmpd.run" "$pkgdir/var/lib/$pkgname/services/utmpd/run"
- echo 3 > "$pkgdir/var/lib/$pkgname/services/utmpd/notification-fd"
- s6-mkfifodir -g0 -- "$pkgdir/var/lib/$pkgname/services/utmpd/event"
- cp -f "$srcdir/wtmpd.run" "$pkgdir/var/lib/$pkgname/services/wtmpd/run"
- echo 3 > "$pkgdir/var/lib/$pkgname/services/wtmpd/notification-fd"
- s6-mkfifodir -g 0 -- "$pkgdir/var/lib/$pkgname/services/wtmpd/event"
- chmod 0755 "$pkgdir/etc/init.d/$pkgname" "$pkgdir/var/lib/$pkgname/services/utmpd/run" "$pkgdir/var/lib/$pkgname/services/wtmpd/run"
- mkdir -m 0700 "$pkgdir/var/lib/$pkgname/services/utmpd/supervise" "$pkgdir/var/lib/$pkgname/services/wtmpd/supervise"
- dd if=/dev/zero of="$pkgdir/var/lib/$pkgname/services/utmpd/supervise/status" bs=35 count=1
- dd if=/dev/zero of="$pkgdir/var/lib/$pkgname/services/wtmpd/supervise/status" bs=35 count=1
+ mkdir -p -m 0755 "$pkgdir/etc/s6/early-services/utmpd" "$pkgdir/etc/s6/early-services/wtmpd"
+ cp -f "$srcdir/utmpd.run" "$pkgdir/etc/s6/early-services/utmpd/run"
+ echo 3 > "$pkgdir/etc/s6/early-services/utmpd/notification-fd"
+ cp -f "$srcdir/wtmpd.run" "$pkgdir/etc/s6/early-services/wtmpd/run"
+ echo 3 > "$pkgdir/etc/s6/early-services/wtmpd/notification-fd"
+ chmod 0755 "$pkgdir/etc/s6/early-services/utmpd/run" "$pkgdir/etc/s6/early-services/wtmpd/run"
}
doc() {
@@ -54,6 +47,5 @@ doc() {
}
sha512sums="663e9479ad9b684068769c7b2b8c9ac3a4ca46a945a86d909f43d9c19712099ea913b3a87cda5b56b72ec891dbecc2c61b518f985418c45d81d72a5afb366db8 utmps-0.0.1.2.tar.gz
-437d0c52ef1ecd23775990225647c2a6ca53691fb5688ffa866a0e6db177a08fe465f2e683e8b98ba668d8ddcd4ffa0fe3939f23ded276f4ca7acaa2553b10e6 utmps.initd
-0ec30284c64c6ea9f25142c5f4a643bd48b137fe85781b650104f5137ffa4dfc35ca7be3e41e3acd3403ebe1d8c5378073afa4e2f3607d3d794fcd9f98ed51c4 utmpd.run
-cba4f2ec3b8f5becf3ae57eecf584745d783046ee6cf5d116322421ad5ffd074d2955da22d31d2b5b1d05f906378aae92f221d2ac95ac21b54a361fbdc0566e7 wtmpd.run"
+525d43e3eced30c564e5390fc715b6caa1ae2b6515a9e3bf01263ff3fb9379bd6908ed302d0d50b6568ac36ed44d272dcc44a683f9ae34d586d8ad17023ed6b1 utmpd.run
+93e4fae527ada9381e0b0a7ad5de9079e8d88959abd74fa5c0710c30c6153832abb010b57ddf83055ca34c032e7e5c9c1eedceb2f122a11ab20837ab66dcf5e2 wtmpd.run"
diff --git a/system/utmps/utmpd.run b/system/utmps/utmpd.run
index 47bc824a2..5d66c183c 100644
--- a/system/utmps/utmpd.run
+++ b/system/utmps/utmpd.run
@@ -1,6 +1,8 @@
#!/bin/execlineb -P
fdmove -c 2 1
+if { mkdir -p -m 0755 /run/utmps }
+if { chown utmp:utmp /run/utmps }
s6-setuidgid utmp
cd /run/utmps
fdmove 1 3
diff --git a/system/utmps/utmps.initd b/system/utmps/utmps.initd
deleted file mode 100644
index db4570031..000000000
--- a/system/utmps/utmps.initd
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 2018 Laurent Bercot
-# Distributed under the terms of the ISC License.
-#
-# OpenRC is only used here to trigger the s6 mechanisms.
-
-depend() {
- need s6
-}
-
-start() {
- ebegin "Starting utmpd and wtmpd services"
- mkdir -p -m 0755 /run/utmps
- chown utmp:utmp /run/utmps
-
- # OpenRC has no readiness notification framework, so it can run this before s6 is ready.
- # To avoid the race (yes, I have hit it), do a polling check here.
- # If you want to avoid unnecessary delays, switch to a real service manager like s6-rc.
- until test -e /run/service/.s6-svscan/control ; do sleep 1 ; done
-
- ln -nsf /var/lib/utmps/services/utmpd /run/service/utmpd
- ln -nsf /var/lib/utmps/services/wtmpd /run/service/wtmpd
- s6-svlisten -U -t 5000 -- /var/lib/utmps/services/utmpd /var/lib/utmps/services/wtmpd "" s6-svscanctl -an /run/service
- eend $?
-}
-
-stop() {
- ebegin "Stopping utmpd and wtmpd services"
- rm -f /run/service/utmpd /run/service/wtmpd
- s6-svlisten -d -t 5000 -- /var/lib/utmps/services/utmpd /var/lib/utmps/services/wtmpd "" s6-svscanctl -an /run/service
- eend $?
-}
diff --git a/system/utmps/utmps.post-upgrade b/system/utmps/utmps.post-upgrade
new file mode 100644
index 000000000..aab5eb125
--- /dev/null
+++ b/system/utmps/utmps.post-upgrade
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+rm -f /etc/runlevels/default/utmps
diff --git a/system/utmps/utmps.pre-install b/system/utmps/utmps.pre-install
index 6db960686..10b5b31ff 100644
--- a/system/utmps/utmps.pre-install
+++ b/system/utmps/utmps.pre-install
@@ -2,5 +2,4 @@
addgroup -S utmp 2>/dev/null
adduser -S -D -H -s /bin/false -G utmp -g utmp utmp 2>/dev/null
-echo 'Run "rc-update add s6 default; rc-update add utmps default" to automatically start the utmpd and wtmpd services at boot time.' 1>&2
exit 0
diff --git a/system/utmps/utmps.pre-upgrade b/system/utmps/utmps.pre-upgrade
index 6db960686..10b5b31ff 100644
--- a/system/utmps/utmps.pre-upgrade
+++ b/system/utmps/utmps.pre-upgrade
@@ -2,5 +2,4 @@
addgroup -S utmp 2>/dev/null
adduser -S -D -H -s /bin/false -G utmp -g utmp utmp 2>/dev/null
-echo 'Run "rc-update add s6 default; rc-update add utmps default" to automatically start the utmpd and wtmpd services at boot time.' 1>&2
exit 0
diff --git a/system/utmps/wtmpd.run b/system/utmps/wtmpd.run
index ab5a40641..fa78806c9 100644
--- a/system/utmps/wtmpd.run
+++ b/system/utmps/wtmpd.run
@@ -1,6 +1,8 @@
#!/bin/execlineb -P
fdmove -c 2 1
+if { mkdir -p -m 0755 /run/utmps }
+if { chown utmp:utmp /run/utmps }
s6-setuidgid utmp
cd /run/utmps
fdmove 1 3