From 1d1f0bf8c6205ef9c065aedbf7511985acf16e06 Mon Sep 17 00:00:00 2001 From: Gofannon Date: Mon, 18 Jun 2018 00:16:06 +0200 Subject: [PATCH] [fix] Correct the removal of old files --- scripts/upgrade | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index fb4edf5..f779776 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -133,10 +133,23 @@ fi # See https://www.dokuwiki.org/update_check touch $final_path/doku.php -# Remove deleted files +# Remove files not used anymore after upgrade # See https://www.dokuwiki.org/install:unused_files -if [ -f "../sources/data/deleted.files" ]; then - grep -Ev '^($|#)' ../sources/data/deleted.files | xargs -I {} sudo rm -vrf $final_path/{} +if [ -f "$final_path/data/deleted.files" ]; then + # Move to the dokuwiki installation folder so the "official" commands can be used without adaptation + cd $final_path + + # This command could not remove directory + #grep -Ev '^($|#)' data/deleted.files | xargs -n 1 rm -vf + # => "rm: cannot remove 'vendor/easybook/geshi': Is a directory" + + # That one works as expected + grep -Ev '^($|#)' data/deleted.files | xargs -n 1 rm -fr + + # bash "hack" to move back to the location user was before the last cd made + # See http://winterdrake.com/unixlinux-trick-cd-back-to-the-previous-directory/ + # Should be the script folder of the package + cd - fi # Update all plugins