Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
Date: Thu, 28 Aug 2014 14:49:59
Message-Id: 1409179714.6f3f50d4530f583d0d2aedec8af20077a9d07f4f.williamh@OpenRC
1 commit: 6f3f50d4530f583d0d2aedec8af20077a9d07f4f
2 Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
3 AuthorDate: Mon Aug 25 19:37:45 2014 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 27 22:48:34 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f3f50d4
7
8 tmpfiles.sh: add support for + modifier
9
10 systemd added support for b+, c+, p+, and L+ in 2e78fa79 and 1554afae to
11 remove the target path if it already exists.
12
13 ---
14 sh/tmpfiles.sh.in | 19 +++++++++++++++++--
15 1 file changed, 17 insertions(+), 2 deletions(-)
16
17 diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
18 index 42a3639..41f86cf 100755
19 --- a/sh/tmpfiles.sh.in
20 +++ b/sh/tmpfiles.sh.in
21 @@ -304,6 +304,7 @@ for FILE in $tmpfiles_d ; do
22 # But IS allowed when globs are expanded for the x/r/R/z/Z types.
23 while read cmd path mode uid gid age arg; do
24 LINENUM=$(( LINENUM+1 ))
25 + FORCE=0
26
27 # Unless we have both command and path, skip this line.
28 if [ -z "$cmd" -o -z "$path" ]; then
29 @@ -311,13 +312,20 @@ for FILE in $tmpfiles_d ; do
30 fi
31
32 case $cmd in
33 - *!) [ "$BOOT" -eq "1" ] || continue; cmd=${cmd%!} ;;
34 + \#*) continue ;;
35 esac
36
37 + while [ ${#cmd} -gt 1 ]; do
38 + case $cmd in
39 + *!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;;
40 + *+) cmd=${cmd%+}; FORCE=1; ;;
41 + *) warninvalid ; continue 2 ;;
42 + esac
43 + done
44 +
45 # whine about invalid entries
46 case $cmd in
47 f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
48 - \#*) continue ;;
49 *) warninvalid ; continue ;;
50 esac
51
52 @@ -338,6 +346,13 @@ for FILE in $tmpfiles_d ; do
53
54 [ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
55 [ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
56 +
57 + if [ $FORCE -gt 0 ]; then
58 + case $cmd in
59 + p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f "$path"
60 + esac
61 + fi
62 +
63 [ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
64 _$cmd "$@"
65 rc=$?