From 9798513d252bb57189897914c5bd603b948f5b6d Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 3 Apr 2012 20:18:45 +0200 Subject: [PATCH] overlay: fixed directory removal/overriding support --- lib/overlay/overlay-functions.in | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/overlay/overlay-functions.in b/lib/overlay/overlay-functions.in index 4130fd7..494833e 100644 --- a/lib/overlay/overlay-functions.in +++ b/lib/overlay/overlay-functions.in @@ -66,12 +66,20 @@ overlay_apply() { xtarget="$rootfs/$target" targetdir="${xtarget%/*}" if [ -L "$xtarget" -o -e "$xtarget" ]; then - if [ "$overwrite" = yes ]; then - [ "$type" = patch ] || rm -f "$xtarget" - else + if [ "$type" != rm -a "$overwrite" != yes ]; then $echo_status "skipping $target ($type)" continue fi + + if [ "$type" = patch ]; then + : + elif [ ! -d "$xtarget/" ]; then + rm -f "$xtarget" + elif [ "$type" = rm ]; then + rm -rf "$xtarget" + else + rmdir "$xtarget" + fi fi # final adjustments based on the type @@ -99,7 +107,6 @@ overlay_apply() { ;; rm) $echo_status "removing $target" - rm -f "$xtarget" ;; patch) $echo_status "overlay: patching $target"