tmpfiles.d init.d scripts

Now that the tmpfiles.d code is more tested, actually call it from
init.d. It assumes that /run is already available when it runs.

Please note it runs TWICE.
- During sysinit, ideally just after /dev/shm is created, but before
  udev has started. After udev is also acceptable, but not ideal.
- During boot, ideally just after localmount has completed.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2012-09-26 15:42:37 -07:00
parent 5c736ad63e
commit 4ff71bd741
8 changed files with 48 additions and 4 deletions

View File

@ -1,5 +1,5 @@
DIR= ${CONFDIR}
CONF= bootmisc fsck hostname localmount urandom ${CONF-${OS}}
CONF= bootmisc fsck hostname localmount urandom tmpfilesd ${CONF-${OS}}
ifeq (${MKNET},)
CONF+= network staticroute

3
conf.d/tmpfilesd Normal file
View File

@ -0,0 +1,3 @@
# Extra options for tmpfiles.sh
#tmpfiles_opts="--verbose"
tmpfiles_opts=""

2
init.d/.gitignore vendored
View File

@ -41,3 +41,5 @@ syslogd
termencoding
ttys
wscons
tmpfilesd.boot
tmpfilesd.sysinit

View File

@ -1,6 +1,7 @@
DIR= ${INITDIR}
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
root.in savecache.in swap.in swapfiles.in \
tmpfilesd.boot.in tmpfilesd.sysinit.in \
swclock.in sysctl.in urandom.in ${SRCS-${OS}}
BIN= ${OBJS}

18
init.d/tmpfilesd.boot.in Normal file
View File

@ -0,0 +1,18 @@
#!@PREFIX@/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Released under the 2-clause BSD license.
description="Create tmpfiles.d entries (boot)"
depend()
{
need localmount
}
start()
{
ebegin "${description/Create/Creating}"
@LIBEXECDIR@/sh/tmpfiles.sh --create ${tmpfiles_opts}
eend $?
return 0
}

View File

@ -0,0 +1,20 @@
#!@PREFIX@/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Released under the 2-clause BSD license.
description="Create tmpfiles.d entries (sysinit)"
depend()
{
# Convert to 'need dev' when the new udev is ready, for OpenRC 0.11
#need dev-mount
need dev
}
start()
{
ebegin "${description/Create/Creating}"
@LIBEXECDIR@/sh/tmpfiles.sh --create ${tmpfiles_opts}
eend $?
return 0
}

View File

@ -38,9 +38,9 @@ BOOT-FreeBSD+= hostid newsyslog savecore syslogd
# FreeBSD specific stuff
BOOT-FreeBSD+= adjkerntz dumpon syscons
BOOT-Linux+= hwclock keymaps modules mtab procfs termencoding
BOOT-Linux+= hwclock keymaps modules mtab procfs termencoding tmpfilesd.boot
SHUTDOWN-Linux= killprocs mount-ro
SYSINIT-Linux= devfs dmesg sysfs
SYSINIT-Linux= devfs dmesg sysfs tmpfilesd.sysinit
# Generic BSD stuff
BOOT-NetBSD+= hostid newsyslog savecore syslogd

View File

@ -266,7 +266,7 @@ for FILE in $tmpfiles_d ; do
# whine about invalid entries
case $1 in
f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
\#) continue ;;
\#) continue ;;
*) warninvalid ; continue ;;
esac