Merge pull request #21 from codingCoffee/dirfix

fix: config directory
This commit is contained in:
Andros Fenollosa 2023-05-29 10:03:56 +02:00 committed by GitHub
commit a179a5898c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
maza
View File

@ -8,7 +8,7 @@ URL_DNS_LIST="https://pgl.yoyo.org/adservers/serverlist.php?showintro=0&mimetype
NAME_OSX="Darwin" NAME_OSX="Darwin"
THIS_OS=$(uname -mrs) THIS_OS=$(uname -mrs)
PROGNAME=$(basename "$0") PROGNAME=$(basename "$0")
[[ -z "${XDG_CONFIG_HOME}" ]] && CONFIG=$HOME/.maza/ || CONFIG=$XDG_CONFIG_HOME/maza [[ -z "${XDG_CONFIG_HOME}" ]] && CONFIG=$HOME/.maza/ || CONFIG=$XDG_CONFIG_HOME/maza/
HOST_FILE=/etc/hosts HOST_FILE=/etc/hosts
COLOR_RED=$(tput setaf 1) COLOR_RED=$(tput setaf 1)
COLOR_GREEN=$(tput setaf 2) COLOR_GREEN=$(tput setaf 2)
@ -91,7 +91,7 @@ update() {
custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST" custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST"
custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST" custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST"
## Add end tag DNS list in first line ## Add end tag DNS list in first line
echo "$END_TAG" >> "$CONFIG/$LIST" echo "$END_TAG" >> "$CONFIG$LIST"
## Add start tag DNS dnsmasq in first line ## Add start tag DNS dnsmasq in first line
custom-sed -i.bak "1i\\$AUTHOR" "$CONFIG$LIST_DNSMASQ" custom-sed -i.bak "1i\\$AUTHOR" "$CONFIG$LIST_DNSMASQ"
custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST_DNSMASQ" custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST_DNSMASQ"
@ -99,11 +99,11 @@ update() {
## Add end tag DNS DNSMASQ in first line ## Add end tag DNS DNSMASQ in first line
echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ" echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ"
# Remove the domains to ignore. They are located in ".maza/ignore" # Remove the domains to ignore. They are located in ".maza/ignore"
if [ -f "$CONFIG/$IGNORE_LIST_FILE" ]; then if [ -f "$CONFIG$IGNORE_LIST_FILE" ]; then
while IFS= read -r domain; do while IFS= read -r domain; do
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST" custom-sed -i.bak "/$domain/d" "$CONFIG$LIST"
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST_DNSMASQ" custom-sed -i.bak "/$domain/d" "$CONFIG$LIST_DNSMASQ"
done < "$CONFIG/$IGNORE_LIST_FILE" done < "$CONFIG$IGNORE_LIST_FILE"
fi fi
# Remove temp file # Remove temp file
rm "$CONFIG$LIST.bak" rm "$CONFIG$LIST.bak"
@ -115,7 +115,7 @@ update() {
start() { start() {
update update
# Add List to host file # Add List to host file
cat "$CONFIG/$LIST" >> "$HOST_FILE" cat "$CONFIG$LIST" >> "$HOST_FILE"
# Notify user # Notify user
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}" echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
} }