summaryrefslogtreecommitdiff
path: root/system/utmps
diff options
context:
space:
mode:
Diffstat (limited to 'system/utmps')
-rw-r--r--system/utmps/APKBUILD43
-rw-r--r--system/utmps/btmpd.run8
-rw-r--r--system/utmps/utmps.initd30
-rw-r--r--system/utmps/wtmpd.run6
4 files changed, 71 insertions, 16 deletions
diff --git a/system/utmps/APKBUILD b/system/utmps/APKBUILD
index dae854ed2..ccdc0c615 100644
--- a/system/utmps/APKBUILD
+++ b/system/utmps/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=utmps
-pkgver=0.1.1.0
+pkgver=0.1.2.0
pkgrel=0
pkgdesc="A secure utmp/wtmp implementation"
url="https://skarnet.org/software/$pkgname/"
@@ -9,13 +9,15 @@ arch="all"
options="!check" # No test suite
license="ISC"
depends="execline s6"
-_skalibs_version=2.11.1
+_skalibs_version=2.12
makedepends="skalibs-dev>=$_skalibs_version"
-subpackages="$pkgname-libs $pkgname-dev $pkgname-libs-dev:libsdev $pkgname-doc"
+subpackages="$pkgname-libs $pkgname-dev $pkgname-libs-dev:libsdev $pkgname-doc $pkgname-openrc"
install="$pkgname.post-upgrade"
source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz
utmpd.run
- wtmpd.run"
+ wtmpd.run
+ btmpd.run
+ utmps.initd"
build() {
./configure \
@@ -33,15 +35,31 @@ build() {
package() {
make DESTDIR="$pkgdir" install
runimage="$pkgdir/etc/s6-linux-init/current/run-image"
- mkdir -p -m 0755 "$runimage/utmps" "$runimage/service/utmpd" "$runimage/service/wtmpd"
+ mkdir -p -m 0755 "$runimage/utmps" "$runimage/service/utmpd"
chown utmp:utmp "$runimage/utmps"
cp -f "$srcdir/utmpd.run" "$runimage/service/utmpd/run"
echo 3 > "$runimage/service/utmpd/notification-fd"
- cp -f "$srcdir/wtmpd.run" "$runimage/service/wtmpd/run"
- echo 3 > "$runimage/service/wtmpd/notification-fd"
- chmod 0755 "$runimage/service/utmpd/run" "$runimage/service/wtmpd/run"
+ chmod 0755 "$runimage/service/utmpd/run"
+ install -D -m755 "$srcdir/utmps.initd" "$pkgdir/etc/init.d/utmps"
}
+openrc() {
+ rldir="$subpkgdir"/etc/runlevels/boot
+ subrunimage="$subpkgdir/etc/s6-linux-init/current/run-image"
+ default_openrc
+ mkdir -p -m 0755 "$rldir" "$subpkgdir/var/log/wtmpd" "$subrunimage/service/wtmpd" "$subrunimage/service/btmpd"
+ cp -f "$srcdir/wtmpd.run" "$subrunimage/service/wtmpd/run"
+ echo 3 > "$subrunimage/service/wtmpd/notification-fd"
+ touch "$subrunimage/service/wtmpd/down"
+ cp -f "$srcdir/btmpd.run" "$subrunimage/service/btmpd/run"
+ echo 3 > "$subrunimage/service/btmpd/notification-fd"
+ touch "$subrunimage/service/btmpd/down"
+ chmod 0755 "$subrunimage/service/wtmpd/run" "$subrunimage/service/btmpd/run"
+ chown utmp:utmp "$subpkgdir/var/log/wtmpd"
+ ln -s wtmpd/wtmp "$subpkgdir/var/log/wtmp"
+ ln -s wtmpd/btmp "$subpkgdir/var/log/btmp"
+ ln -s ../../init.d/utmps "$rldir/utmps"
+}
libs() {
pkgdesc="$pkgdesc (shared libraries)"
@@ -50,7 +68,6 @@ libs() {
mv "$pkgdir"/lib/*.so.* "$subpkgdir/lib/"
}
-
dev() {
pkgdesc="$pkgdesc (development files)"
depends="skalibs-dev>=$_skalibs_version"
@@ -59,7 +76,6 @@ dev() {
mv "$pkgdir/usr/lib" "$pkgdir/usr/include" "$subpkgdir/usr/"
}
-
libsdev() {
pkgdesc="$pkgdesc (development files for dynamic linking)"
depends="$pkgname-dev"
@@ -67,7 +83,6 @@ libsdev() {
mv "$pkgdir"/lib/*.so "$subpkgdir/lib/"
}
-
doc() {
pkgdesc="$pkgdesc (documentation)"
depends=""
@@ -76,6 +91,8 @@ doc() {
cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
}
-sha512sums="13a6791df2d246c2e2b04176bc614cc0ee238cc2131aa893e0abb7250f9e10598b0d3a5e8ed26cb18a9dffea16bc75a1787d537a80067588bc8e4388139de78f utmps-0.1.1.0.tar.gz
+sha512sums="a89c054584680ec1abeb145d244488433cbb3e837fbd77e8914c402e84ce7bc50615c8cf13e7f97316096417fcd5ed84a24f618b4714c640cd8e39fb6749b00d utmps-0.1.2.0.tar.gz
0ec30284c64c6ea9f25142c5f4a643bd48b137fe85781b650104f5137ffa4dfc35ca7be3e41e3acd3403ebe1d8c5378073afa4e2f3607d3d794fcd9f98ed51c4 utmpd.run
-cba4f2ec3b8f5becf3ae57eecf584745d783046ee6cf5d116322421ad5ffd074d2955da22d31d2b5b1d05f906378aae92f221d2ac95ac21b54a361fbdc0566e7 wtmpd.run"
+9e875a5cd37be531320a8e582afed2c980dd0a1bdfc2f6f3d826d5e5389fc6ab93f973ed1506edb23f4c73cf24a2357aefe856148eaacff86c2aafe376c575e2 wtmpd.run
+503bdbb3d244243934b9b4e3deea0bf92a95f88417c822ad9cf6202584d4724d5e182a0d88d7f09069e435a8a97230b85d2b264736c85c893da193fd5ec34c71 btmpd.run
+3a658c7b078f3df4d20192b0719c2c8ac5b08083c7c36807ef39ab67232ffacc64429c63fba27a06d509048b3ebf47128885ef34aa4b6fac1ad8df894cbb604a utmps.initd"
diff --git a/system/utmps/btmpd.run b/system/utmps/btmpd.run
new file mode 100644
index 000000000..56a5de77e
--- /dev/null
+++ b/system/utmps/btmpd.run
@@ -0,0 +1,8 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-setuidgid utmp
+cd /var/log/wtmpd
+fdmove 1 3
+s6-ipcserver -1 -- /run/utmps/.btmpd-socket
+utmps-wtmpd btmp
diff --git a/system/utmps/utmps.initd b/system/utmps/utmps.initd
new file mode 100644
index 000000000..c6f884a52
--- /dev/null
+++ b/system/utmps/utmps.initd
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 2022 Adélie Linux
+
+description="boot script for the utmps wtmp and btmp services"
+
+depend()
+{
+ need localmount
+ after bootmisc
+ before networking
+}
+
+stop()
+{
+ ebegin "Stopping the utmps wtmp and btmp services"
+ touch /run/service/wtmpd/down /run/service/btmpd/down
+ s6-svc -d /run/service/btmpd
+ s6-svc -d /run/service/wtmpd
+ eend $?
+}
+
+start()
+{
+ ebegin "Starting the utmps wtmp and btmp services"
+ rm -f /run/service/wtmpd/down /run/service/btmpd/down
+ s6-svlisten -U " /run/service/wtmpd" " /run/service/btmpd" "" \
+ foreground " s6-svc" " -u" " /run/service/wtmpd" "" \
+ s6-svc -u /run/service/btmpd
+ eend $?
+}
diff --git a/system/utmps/wtmpd.run b/system/utmps/wtmpd.run
index ab5a40641..599c63b83 100644
--- a/system/utmps/wtmpd.run
+++ b/system/utmps/wtmpd.run
@@ -2,7 +2,7 @@
fdmove -c 2 1
s6-setuidgid utmp
-cd /run/utmps
+cd /var/log/wtmpd
fdmove 1 3
-s6-ipcserver -1 -- .wtmpd-socket
-utmps-wtmpd
+s6-ipcserver -1 -- /run/utmps/.wtmpd-socket
+utmps-wtmpd wtmp