diff options
| author | Natanael Copa <ncopa@alpinelinux.org> | 2018-06-25 10:35:01 +0000 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-06-25 10:35:01 +0000 |
| commit | a2fb70e278ef9a17b069c3cd5e82830f14964de3 (patch) | |
| tree | 6d54c385d21bd3760363b1e0f9fa1bb91d819163 /testing/utmps/utmps.initd | |
| parent | 86e7ebb6cd46b846d9ed45fa02d15080efe9c0ed (diff) | |
| download | aports-a2fb70e278ef9a17b069c3cd5e82830f14964de3.tar.bz2 aports-a2fb70e278ef9a17b069c3cd5e82830f14964de3.tar.xz | |
testing/utmps: move from main
new packages should be added to testing first
Diffstat (limited to 'testing/utmps/utmps.initd')
| -rw-r--r-- | testing/utmps/utmps.initd | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/utmps/utmps.initd b/testing/utmps/utmps.initd new file mode 100644 index 0000000000..db4570031c --- /dev/null +++ b/testing/utmps/utmps.initd @@ -0,0 +1,32 @@ +#!/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 $? +} |
