mirror of
https://github.com/tanrax/maza-ad-blocking.git
synced 2024-11-10 02:15:42 +01:00
fix: config directory
the script is currently polluting the ~/.config folder by creating files like ~/.config/mazalist instead of ~/.config/maza/list. This PR aims to fix that Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
2d356aedd1
commit
337126e4e4
10
maza
10
maza
@ -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}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user