diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-08-25 15:46:28 -0400 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2014-08-27 17:49:00 -0500 |
commit | d4204a97a2410fcf37a64385204e6452c6958e8d (patch) | |
tree | 9b638b0c6218af0326ce897b7ed953185b414c33 /sh/tmpfiles.sh.in | |
parent | 6f3f50d4530f583d0d2aedec8af20077a9d07f4f (diff) |
tmpfiles.sh: add support for C action
Recursively copies files or directories. Added by systemd in 849958d1.
Diffstat (limited to 'sh/tmpfiles.sh.in')
-rwxr-xr-x | sh/tmpfiles.sh.in | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in index 41f86cf1..6e7be420 100755 --- a/sh/tmpfiles.sh.in +++ b/sh/tmpfiles.sh.in @@ -80,6 +80,17 @@ _c() { fi } +_C() { + # recursively copy a file or directory + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ ! -e "$path" ]; then + dryrun_or_real cp -r "$arg" "$path" + _restorecon "$path" + [ $uid != '-' ] && dryrun_or_real chown "$uid" "$path" + [ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path" + [ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path" + fi +} _f() { # Create a file if it doesn't exist yet @@ -325,7 +336,7 @@ for FILE in $tmpfiles_d ; do # whine about invalid entries 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|C|b|x|X|r|R|z|Z) ;; *) warninvalid ; continue ;; esac @@ -334,7 +345,7 @@ for FILE in $tmpfiles_d ; do case "$cmd" in p|f|F) mode=0644 ;; d|D) mode=0755 ;; - z|Z|x|r|R|L) ;; + C|z|Z|x|r|R|L) ;; esac fi |