Skip to content

Commit

Permalink
scripts/bindhosts: sed-ify dos2unix
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanyee33 authored and backslashxx committed Dec 14, 2024
1 parent 728dbcf commit 7038700
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/bindhosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ adblock() {
for i in $(sed '/#/d' $PERSISTENT_DIR/whitelist.txt); do echo "0.0.0.0 $i" ; done >> $folder/tempwhitelist
# sed strip out everything with #, double space to single space, replace all 127.0.0.1 to 0.0.0.0
# then sort uniq, then grep out whitelist.txt from it
sed -i '/#/d; s/ / /g; /^$/d; s/127.0.0.1/0.0.0.0/' $folder/temphosts
sort_cmd "$folder/temphosts" | grep -Fxvf $folder/tempwhitelist | busybox dos2unix >> $target_hostsfile
sed -i '/#/d; s/ / /g; /^$/d; s/\r$//; s/127.0.0.1/0.0.0.0/' $folder/temphosts
sort_cmd "$folder/temphosts" | grep -Fxvf $folder/tempwhitelist >> $target_hostsfile
# mark it, will be read by service.sh to deduce
echo "# bindhosts v$versionCode" >> $target_hostsfile
}
Expand Down

0 comments on commit 7038700

Please sign in to comment.