diff options
author | Jean Delvare <jdelvare@suse.de> | 2012-02-01 18:08:48 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2012-02-01 18:08:48 +0100 |
commit | 3f25ce18333a8afe81ce8968f756ba986bd9b4b5 (patch) | |
tree | cc421987d9df6d50b700aac7e1268c449f2ef1e5 | |
parent | 627e2217ba89d71bf261f664b8e0a9578c8b1572 (diff) | |
download | quilt-3f25ce18333a8afe81ce8968f756ba986bd9b4b5.tar.gz |
BSD compatibility: rmdir
Use rmdir -p instead of open-coding it. The more complex code was
maybe needed to properly handle symbolic links, but we know that
there won't be symbolic links in the backup directory, so the extra
complexity isn't needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
-rw-r--r-- | quilt.changes | 7 | ||||
-rw-r--r-- | quilt/scripts/backup-files.in | 27 |
2 files changed, 10 insertions, 24 deletions
diff --git a/quilt.changes b/quilt.changes index 4cc73cc..0b0b92f 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Feb 1 17:02:32 CET 2012 - jdelvare@suse.de + +- backup-files: Avoid relying on GNU-specific extensions of stat, + cp and rmdir. Otherwise it fails on BSD systems and probably + others. + +------------------------------------------------------------------- Wed Feb 1 16:58:22 CET 2012 - mquinson@debian.org - Make backup-files a shell script. This makes it possible to diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in index 086d178..fcfc995 100644 --- a/quilt/scripts/backup-files.in +++ b/quilt/scripts/backup-files.in @@ -117,14 +117,7 @@ process_file() { $ECHO "Removing $file" if [ -z "$OPT_KEEP_BACKUP" ]; then rm "$backup" - while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ] - do - backup="${backup%/*}" - rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null - if [ -d "$backup" ]; then - break - fi - done + rmdir -p "${backup%/*}" 2> /dev/null || true fi else $ECHO "Restoring $file" @@ -142,14 +135,7 @@ process_file() { if [ -z "$OPT_KEEP_BACKUP" ]; then rm "$backup" - while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ] - do - backup="${backup%/*}" - rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null - if [ -d "$backup" ]; then - break - fi - done + rmdir -p "${backup%/*}" 2> /dev/null || true fi if [ -n "$OPT_TOUCH" ]; then touch "$file" @@ -159,14 +145,7 @@ process_file() { if [ -e "$backup" ]; then rm "$backup" fi - while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ] - do - backup="${backup%/*}" - rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null - if [ -d "$backup" ]; then - break - fi - done + rmdir -p "${backup%/*}" 2> /dev/null || true elif [ -z "$OPT_WHAT" ]; then if [ -e "$file" ] && [ -n "$OPT_NOLINKS" ]; then ensure_nolinks "$file" |