From 80b27145dcdf8e2bee41e450a633e30d366906f1 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 24 Dec 2011 23:14:49 -0500 Subject: arch-tmpfiles: don't truncate directories on --create arch-tmpfiles should not truncate directories when invoked with --create. This matches behavior from systemd's tmpfiles binary. Signed-off-by: Dave Reisner --- arch-tmpfiles | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'arch-tmpfiles') diff --git a/arch-tmpfiles b/arch-tmpfiles index f133a40..73c4328 100755 --- a/arch-tmpfiles +++ b/arch-tmpfiles @@ -87,17 +87,18 @@ _D() { # Create or empty a directory local path=$1 mode=$2 uid=$3 gid=$4 - (( CREATE )) || return 0 - if ! checkparams 4 "$@"; then warninvalid return fi - if [[ -d $path ]]; then + if [[ -d $path ]] && (( REMOVE )); then find "$path" -mindepth 1 -maxdepth 1 -xdev -print0 | xargs -r0 rm -rf fi - install -d -m"$mode" -o"$uid" -g"$gid" "$path" + + if (( CREATE )); then + install -d -m"$mode" -o"$uid" -g"$gid" "$path" + fi } _p() { -- cgit v1.2.3