diff options
Diffstat (limited to 'debian/configure-instance.in')
-rw-r--r-- | debian/configure-instance.in | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/debian/configure-instance.in b/debian/configure-instance.in index a90c0b8..af3d542 100644 --- a/debian/configure-instance.in +++ b/debian/configure-instance.in @@ -97,7 +97,7 @@ do [ -f /$file ] && cp="$cp /$file" || rm="$rm ./$file" done [ -n "$rm" ] && rm -f $rm -[ -n "$cp" ] && cp -pLu --parents -t . -- $cp +[ -n "$cp" ] && cp -pLuf --parents -t . -- $cp [ -n "$need_chroot" ] || exit 0 @@ -136,17 +136,21 @@ do dest=$queue_directory$cadir if [ -d $dest ]; then ( cd $dest - for f in *; do - case "$f" in - ( [0-9a-f]*[0-9a-f].[0-9] ) [ -f "$cadir/$f" ] || rm -f -- "$f" ;; - ( * ) rm -f -- "$f" ;; - esac - done + # cp does not write over dangling symlinks (#1089836). + # walk through the dest dir, print names of regular files looking + # like a cert (to process later), delete everything else.. + find . -mindepth 1 -maxdepth 1 \( \ + \( -name '[0-9a-f]*[0-9a-f].[0-9]' -type f -print \) \ + -o -delete \ + \) | while read file; do + # ..and remove files which don't exist in source anymore + [ -f "$caddr/$file" ] || rm -f "$file" + done ) fi mkdir -p $dest ( cd $cadir find -L . -name '[0-9a-f]*.[0-9]' -type f \ - -exec cp -pLu -t $dest '{}' + + -exec cp -pLuf -t $dest '{}' + ) done |