tmpfiles: add support for --boot option

For compatibility with systemd-tmpfiles.

Fixes #17

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
Andrew Gregory 2014-03-26 12:13:20 -04:00
parent c081633762
commit 686ee62a79
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,7 @@ depend()
start() start()
{ {
ebegin "setting up tmpfiles.d entries" ebegin "setting up tmpfiles.d entries"
@LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove \ @LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove --boot \
${tmpfiles_opts} ${tmpfiles_opts}
eend $? eend $?
return 0 return 0

View File

@ -214,7 +214,7 @@ _Z() {
CHOPTS=-R relabel "$@" CHOPTS=-R relabel "$@"
} }
CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0 BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
EXCLUDE= EXCLUDE=
PREFIX= PREFIX=
FILE= FILE=
@ -249,6 +249,7 @@ done
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in case $1 in
--boot) BOOT=1 ;;
--create) CREATE=1 ;; --create) CREATE=1 ;;
--remove) REMOVE=1 ;; --remove) REMOVE=1 ;;
--clean) CLEAN=1 ;; # TODO: Not implemented --clean) CLEAN=1 ;; # TODO: Not implemented
@ -266,7 +267,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
fi fi
if [ "$CREATE$REMOVE" = '00' ]; then if [ "$CREATE$REMOVE" = '00' ]; then
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}" printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1 exit 1
fi fi
@ -283,6 +284,7 @@ for FILE in $tmpfiles_d ; do
# Cmd Path Mode UID GID Age Argument # Cmd Path Mode UID GID Age Argument
# d /run/user 0755 root root 10d - # d /run/user 0755 root root 10d -
# Mode, UID, GID, Age, Argument may be omitted! # Mode, UID, GID, Age, Argument may be omitted!
# If Cmd ends with !, the line is only processed if --boot is passed
# XXX: Upstream says whitespace is NOT permitted in the Path argument. # XXX: Upstream says whitespace is NOT permitted in the Path argument.
# But IS allowed when globs are expanded for the x/r/R/z/Z types. # But IS allowed when globs are expanded for the x/r/R/z/Z types.
@ -294,6 +296,10 @@ for FILE in $tmpfiles_d ; do
continue continue
fi fi
case $cmd in
*!) [ "$BOOT" -eq "1" ] || continue; cmd=${cmd%!} ;;
esac
# whine about invalid entries # whine about invalid entries
case $cmd in case $cmd in
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;; f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;