Skip to content

Commit 9297407

Browse files
committed
rmlwk: More logging system improvements
1 parent 05b5759 commit 9297407

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

module/system/bin/rmlwk

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ function remove_hosts() {
117117
# Restore to default entries if hosts file is empty
118118
if [ ! -s "$hosts_file" ]; then
119119
echo "- Warning: Hosts file is empty. Restoring default entries."
120+
log_message "Detected empty hosts file"
121+
log_message "Restoring default entries..."
120122
echo -e "127.0.0.1 localhost\n::1 localhost" > "$hosts_file"
121123
fi
122124

@@ -246,7 +248,7 @@ case "$(tolower "$1")" in
246248
# Add domain to whitelist.txt and remove from hosts
247249
grep -qx "$domain" "$persist_dir/whitelist.txt" && echo "$domain is already whitelisted" || echo "$domain" >> "$persist_dir/whitelist.txt"
248250
sed -i "/0\.0\.0\.0 $domain/d" "$hosts_file" 2>/dev/null
249-
log_message "Added $domain to whitelist."
251+
log_message "Added $domain to whitelist." && echo "- Added $domain to whitelist."
250252
else
251253
# Remove domain from whitelist.txt if found
252254
if grep -qxF "$domain" "$persist_dir/whitelist.txt"; then
@@ -290,7 +292,7 @@ case "$(tolower "$1")" in
290292
fi
291293
;;
292294
--update-hosts)
293-
log_message "Starting to update hosts."
295+
log_message "Starting to update hosts..."
294296
echo "- Downloading updates, Please wait."
295297
nuke_if_we_dont_have_internet
296298

@@ -311,9 +313,9 @@ case "$(tolower "$1")" in
311313
# Update hosts for global whitelist
312314
mkdir -p "$persist_dir/cache/whitelist"
313315
fetch "$persist_dir/cache/whitelist/whitelist.txt" https://raw.githubusercontent.com/ZG089/Re-Malwack/main/whitelist.txt &>/dev/null &
314-
log_message "Downloading whitelist."
316+
log_message "Downloading whitelist..."
315317
fetch "$persist_dir/cache/whitelist/social-whitelist.txt" https://raw.githubusercontent.com/ZG089/Re-Malwack/main/social-whitelist.txt &>/dev/null &
316-
log_message "Downloading social whitelist."
318+
log_message "Downloading social whitelist..."
317319

318320
# Update hosts for custom block
319321
[ -d "$persist_dir/cache/porn" ] && block_content "porn" "update" &
@@ -327,9 +329,9 @@ case "$(tolower "$1")" in
327329
install_hosts
328330

329331
# Check config and apply update
330-
[ "$block_porn" = 1 ] && block_content "porn"
331-
[ "$block_gambling" = 1 ] && block_content "gambling"
332-
[ "$block_fakenews" = 1 ] && block_content "fakenews"
332+
[ "$block_porn" = 1 ] && block_content "porn" && log_message "Updating porn sites blocklist..."
333+
[ "$block_gambling" = 1 ] && block_content "gambling" && log_message "Updating gambling sites blocklist..."
334+
[ "$block_fakenews" = 1 ] && block_content "fakenews" && log_message "Updating Fake news sites blocklist..."
333335
update_status
334336
log_message "Successfully updated hosts."
335337
echo "- Done."

0 commit comments

Comments
 (0)