updater: improve update-exclusion

pull/662/head
Botspot 4 years ago
parent ad71a5e9b0
commit 2c99288d8b

@ -81,8 +81,6 @@ echo "updatable: $updatable"
#if check-all succeeded to download the repo to the update folder #if check-all succeeded to download the repo to the update folder
if [ -d "${DIRECTORY}/update" ];then if [ -d "${DIRECTORY}/update" ];then
PREIFS="$IFS"
IFS="|"
#mainfiles="$(echo -e "$(ls -Rp "${DIRECTORY}/update/pi-apps")\n$(ls -Rp "${DIRECTORY}")" | grep -v '/' | sort | uniq | tr '\n' '|')" #mainfiles="$(echo -e "$(ls -Rp "${DIRECTORY}/update/pi-apps")\n$(ls -Rp "${DIRECTORY}")" | grep -v '/' | sort | uniq | tr '\n' '|')"
@ -94,18 +92,18 @@ if [ -d "${DIRECTORY}/update" ];then
cd "${DIRECTORY}" 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' '|')" mergedfiles="$(echo -e "${localfiles}\n${updatefiles}" | sort | uniq)"
#exclude files mentioned in data/update-exclusion file #exclude files mentioned in data/update-exclusion file
PREIFS="$IFS"
IFS=$'\n' #exclude commented lines IFS=$'\n' #exclude commented lines
for file in $(cat data/update-exclusion | grep "^[^#;]") for file in $(cat "${DIRECTORY}/data/update-exclusion" | grep "^[^#;]")
do do
mergedfiles="$(echo "$mergedfiles" | grep -v "$file")" mergedfiles="$(echo "$mergedfiles" | grep -v "$file")"
echo "Excluding $file from the mergedlist." echo "Excluding '$file' from the mergedlist."
done done
IFS="$PREIFS" # back to IFS='|' IFS="|" # back to IFS='|'
mergedfiles="$(echo "$mergedfiles" | tr '\n' '|')"
for file in $mergedfiles for file in $mergedfiles
do do
newhash=$(cat "${DIRECTORY}/update/pi-apps/${file}" 2>/dev/null | sha1sum | awk '{print $1}' | sha1sum | awk '{print $1}') newhash=$(cat "${DIRECTORY}/update/pi-apps/${file}" 2>/dev/null | sha1sum | awk '{print $1}' | sha1sum | awk '{print $1}')

Loading…
Cancel
Save