Fix blocklist permissions on first generation

This commit is contained in:
Dan Church 2022-12-15 11:54:02 -06:00
parent 8fbca993fa
commit afa73e31f6
Signed by: h3xx
GPG Key ID: EA2BF379CD2CDBD0
2 changed files with 15 additions and 0 deletions

View File

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Prevent AdroitAdorKhan-EnergizedProtection updates (current repo has a broken
list)
- Fix `block.list` permissions on first generation.
### Removed
- Removed in-repo custom ad domains list

View File

@ -92,6 +92,20 @@ done
TEMP_BLOCKLIST=$(mktemp -p "$TEMP_DIR")
"$WORKDIR/make-block.pl" --out="$TEMP_BLOCKLIST"
# Blocklist generation succeeded, install it!
if [[ ! -e $BLOCKLIST ]]; then
(
# First time:
# Create an empty blocklist with -rw-r--r-- permissions.
# Prevents file not being readable; disregard permissions coming from
# whatever file permissions 'mktemp' sets.
umask 0022
touch -- "$BLOCKLIST"
)
fi
replace_with "$BLOCKLIST" "$TEMP_BLOCKLIST"
if [[ ${#DNSMASQ_RESTART_COMMAND[@]} -gt 0 ]]; then