From 992d8f053b5fd858311814ef5c5eda819f114230 Mon Sep 17 00:00:00 2001 From: Botspot Date: Mon, 22 Mar 2021 11:22:36 -0500 Subject: [PATCH] update-exclusion file specify files/folders to prevent from being updated --- data/update-exclusion | 3 +++ updater | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 data/update-exclusion diff --git a/data/update-exclusion b/data/update-exclusion new file mode 100644 index 0000000..dba10e5 --- /dev/null +++ b/data/update-exclusion @@ -0,0 +1,3 @@ +# This file contains files & directories that you don't want to be updated by the Pi-Apps updater script. Each line is run through grep -v, and the paths don't have to be absolute. 'icons/' is enough to exclude the pi-apps icons folder. + +#icons/ # <-- uncomment to exclude the icons fo0lder from being updated diff --git a/updater b/updater index 72b6917..b691529 100755 --- a/updater +++ b/updater @@ -92,9 +92,20 @@ if [ -d "${DIRECTORY}/update" ];then #list all files in main folder cd "${DIRECTORY}" - localfiles="$(find . -type f | cut -c 3- | grep -v '.git/' | grep -v 'apps/' | grep -v 'data/' | grep -v 'xlunch/')" + localfiles="$(find . -type f | cut -c 3- | grep -v '.git/' | grep -v 'apps/' | grep -v 'data/' | grep -v 'xlunch/')" mergedfiles="$(echo -e "${localfiles}\n${updatefiles}" | sort | uniq | tr '\n' '|')" + + #exclude files mentioned in data/update-exclusion file + PREIFS="$IFS" + IFS=$'\n' #exclude commented lines + for file in $(cat data/update-exclusion | grep "^[^#;]") + do + mergedfiles="$(echo "$mergedfiles" | grep -v "$file")" + echo "Excluding $file from the mergedlist." + done + IFS="$PREIFS" # back to IFS='|' + for file in $mergedfiles do newhash=$(cat "${DIRECTORY}/update/pi-apps/${file}" 2>/dev/null | sha1sum | awk '{print $1}' | sha1sum | awk '{print $1}')