diff options
author | Dave Reisner <dreisner@archlinux.org> | 2011-12-24 23:14:49 -0500 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2011-12-26 10:17:44 -0500 |
commit | 80b27145dcdf8e2bee41e450a633e30d366906f1 (patch) | |
tree | 1b6af9dd730168c418180776a7c66eae278b7721 | |
parent | 9bf1b81cf3a5d8f045147e2d89ecbac5dfc9c2ff (diff) | |
download | initscripts-80b27145dcdf8e2bee41e450a633e30d366906f1.tar.xz |
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 <dreisner@archlinux.org>
-rwxr-xr-x | arch-tmpfiles | 9 |
1 files changed, 5 insertions, 4 deletions
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() { |