commit: 6f3f50d4530f583d0d2aedec8af20077a9d07f4f
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Mon Aug 25 19:37:45 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 27 22:48:34 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f3f50d4
tmpfiles.sh: add support for + modifier
systemd added support for b+, c+, p+, and L+ in 2e78fa79 and 1554afae to
remove the target path if it already exists.
---
sh/tmpfiles.sh.in | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 42a3639..41f86cf 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -304,6 +304,7 @@ for FILE in $tmpfiles_d ; do
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
+ FORCE=0
# Unless we have both command and path, skip this line.
if [ -z "$cmd" -o -z "$path" ]; then
@@ -311,13 +312,20 @@ for FILE in $tmpfiles_d ; do
fi
case $cmd in
- *!) [ "$BOOT" -eq "1" ] || continue; cmd=${cmd%!} ;;
+ \#*) continue ;;
esac
+ while [ ${#cmd} -gt 1 ]; do
+ case $cmd in
+ *!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] ||
continue 2 ;;
+ *+) cmd=${cmd%+}; FORCE=1; ;;
+ *) warninvalid ; continue 2 ;;
+ esac
+ done
+
# whine about invalid entries
case $cmd in
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
- \#*) continue ;;
*) warninvalid ; continue ;;
esac
@@ -338,6 +346,13 @@ for FILE in $tmpfiles_d ; do
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
[ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
+
+ if [ $FORCE -gt 0 ]; then
+ case $cmd in
+ p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f
"$path"
+ esac
+ fi
+
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
_$cmd "$@"
rc=$?