Skip to content

Commit a592716

Browse files
committed
Fix: #27
1 parent 4e1aad2 commit a592716

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
4141
### 📡 Update database
4242

4343
``` bash
44-
maza update
44+
sudo maza update
4545
```
4646

4747
### 🔨 Start
@@ -59,7 +59,7 @@ sudo maza stop
5959
### ⚖️ Status
6060

6161
``` bash
62-
maza status
62+
sudo maza status
6363
```
6464

6565
## ⚙️ Install or Update
@@ -106,12 +106,12 @@ TERM=dumb
106106
## 🔪 Uninstall
107107

108108
``` bash
109-
sudo rm /usr/local/bin/maza && sudo rm -r ~/.config/maza
109+
sudo rm /usr/local/bin/maza && sudo rm -r /root/.config/maza
110110
```
111111

112112
## 🚫 Not blocking certain domains
113113

114-
Edit `~/.config/maza/ignore` and add the domains you want to ignore.
114+
Edit `/root/.config/maza/ignore` and add the domains you want to ignore.
115115

116116
Example:
117117

@@ -140,12 +140,12 @@ ip6-allhosts
140140
Finally update Maza to apply the changes.
141141

142142
``` bash
143-
maza update
143+
sudo maza update
144144
```
145145

146146
## 🎯 Add custom domains to block
147147

148-
If you want to include your own domains to be blocked, you can add them to `~/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
148+
If you want to include your own domains to be blocked, you can add them to `/root/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
149149

150150
For example:
151151

@@ -158,7 +158,7 @@ ad.about.com
158158
Then update the database to regenerate the list to include your domains.
159159

160160
```
161-
maza update
161+
sudo maza update
162162
```
163163

164164
## 🔒 Alternative DNS list
@@ -182,7 +182,7 @@ Unfortunately the hosts file does **not support sub-domains (wildcards)**, which
182182
#### 0 Update Maza
183183

184184
```bash
185-
maza update
185+
sudo maza update
186186
```
187187

188188
#### 1 Install
@@ -248,7 +248,7 @@ sudo maza start
248248
#### 0 Update Maza
249249

250250
```bash
251-
maza update
251+
sudo maza update
252252
```
253253

254254
#### 1 Install

maza

+13-3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ update() {
134134
# Remove empty lines
135135
custom-sed -i.bak '/^$/d' "$CONFIG$LIST"
136136

137+
# Update HOST_FILE
138+
## Remove old list
139+
custom-sed -i "/$START_TAG/,/$END_TAG/d" "$HOST_FILE"
140+
## Add List to host file.
141+
# Add start tag DNS list in first line
142+
echo "$START_TAG" >> "$HOST_FILE"
143+
echo "$PROJECT" >> "$HOST_FILE"
144+
echo "$AUTHOR" >> "$HOST_FILE"
145+
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
146+
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
147+
# Add end tag DNS list in first line
148+
echo "$END_TAG" >> "$HOST_FILE"
149+
137150
# Make dnsmasq format
138151
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
139152
## Remove triple "-". Example: "my---domain.com" to "my-domain.com". Only in dnsmasq.
@@ -165,9 +178,6 @@ update() {
165178

166179
start() {
167180
update
168-
# Add List to host file.
169-
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
170-
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
171181
# Notify user
172182
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
173183
}

0 commit comments

Comments
 (0)