Moves chmod after every creation of ${destination} instead of end of function

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
pvogt09 2019-05-12 11:25:48 +02:00
parent 225285cb97
commit 3f90261520

View file

@ -376,6 +376,7 @@ gravity_ParseFileIntoDomains() {
if($0 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { $0="" } if($0 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { $0="" }
if($0) { print $0 } if($0) { print $0 }
}' "${source}" > "${destination}" }' "${source}" > "${destination}"
chmod 644 "${destination}"
# Determine if there are Adblock exception rules # Determine if there are Adblock exception rules
# https://adblockplus.org/filters # https://adblockplus.org/filters
@ -393,6 +394,7 @@ gravity_ParseFileIntoDomains() {
# Remove exceptions # Remove exceptions
comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}" comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}"
mv "${source}" "${destination}" mv "${source}" "${destination}"
chmod 644 "${destination}"
fi fi
echo -e "${OVER} ${TICK} Format: Adblock" echo -e "${OVER} ${TICK} Format: Adblock"
@ -416,11 +418,13 @@ gravity_ParseFileIntoDomains() {
# Print if nonempty # Print if nonempty
length { print } length { print }
' "${source}" 2> /dev/null > "${destination}" ' "${source}" 2> /dev/null > "${destination}"
chmod 644 "${destination}"
echo -e "${OVER} ${TICK} Format: URL" echo -e "${OVER} ${TICK} Format: URL"
else else
# Default: Keep hosts/domains file in same format as it was downloaded # Default: Keep hosts/domains file in same format as it was downloaded
output=$( { mv "${source}" "${destination}"; } 2>&1 ) output=$( { mv "${source}" "${destination}"; } 2>&1 )
chmod 644 "${destination}"
if [[ ! -e "${destination}" ]]; then if [[ ! -e "${destination}" ]]; then
echo -e "\\n ${CROSS} Unable to move tmp file to ${piholeDir} echo -e "\\n ${CROSS} Unable to move tmp file to ${piholeDir}
@ -428,7 +432,6 @@ gravity_ParseFileIntoDomains() {
gravity_Cleanup "error" gravity_Cleanup "error"
fi fi
fi fi
chmod 644 "${destination}"
} }
# Create (unfiltered) "Matter and Light" consolidated list # Create (unfiltered) "Matter and Light" consolidated list