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: 1409179740.d4204a97a2410fcf37a64385204e6452c6958e8d.williamh@OpenRC
1 commit: d4204a97a2410fcf37a64385204e6452c6958e8d
2 Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
3 AuthorDate: Mon Aug 25 19:46:28 2014 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 27 22:49:00 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=d4204a97
7
8 tmpfiles.sh: add support for C action
9
10 Recursively copies files or directories. Added by systemd in 849958d1.
11
12 ---
13 sh/tmpfiles.sh.in | 15 +++++++++++++--
14 1 file changed, 13 insertions(+), 2 deletions(-)
15
16 diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
17 index 41f86cf..6e7be42 100755
18 --- a/sh/tmpfiles.sh.in
19 +++ b/sh/tmpfiles.sh.in
20 @@ -80,6 +80,17 @@ _c() {
21 fi
22 }
23
24 +_C() {
25 + # recursively copy a file or directory
26 + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
27 + if [ ! -e "$path" ]; then
28 + dryrun_or_real cp -r "$arg" "$path"
29 + _restorecon "$path"
30 + [ $uid != '-' ] && dryrun_or_real chown "$uid" "$path"
31 + [ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path"
32 + [ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path"
33 + fi
34 +}
35
36 _f() {
37 # Create a file if it doesn't exist yet
38 @@ -325,7 +336,7 @@ for FILE in $tmpfiles_d ; do
39
40 # whine about invalid entries
41 case $cmd in
42 - f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
43 + f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
44 *) warninvalid ; continue ;;
45 esac
46
47 @@ -334,7 +345,7 @@ for FILE in $tmpfiles_d ; do
48 case "$cmd" in
49 p|f|F) mode=0644 ;;
50 d|D) mode=0755 ;;
51 - z|Z|x|r|R|L) ;;
52 + C|z|Z|x|r|R|L) ;;
53 esac
54 fi