diff options
author | Leo <thinkabit.ukim@gmail.com> | 2019-08-06 10:48:12 -0300 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-08-07 09:34:07 -0300 |
commit | 884e0efe0196ae2398a186ee732e4892b279a0cf (patch) | |
tree | 65f66ac467e32b3a28e9d4a543199e12b9ec5d57 /community/utmps/utmps.initd | |
parent | ea1b97fa3fdec4a005f63553814072b6a07b599d (diff) | |
download | aports-884e0efe0196ae2398a186ee732e4892b279a0cf.tar.bz2 aports-884e0efe0196ae2398a186ee732e4892b279a0cf.tar.xz |
community/utmps: move from testing
Diffstat (limited to 'community/utmps/utmps.initd')
-rw-r--r-- | community/utmps/utmps.initd | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/community/utmps/utmps.initd b/community/utmps/utmps.initd new file mode 100644 index 0000000000..db4570031c --- /dev/null +++ b/community/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 $? +} |