Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
improve make-trivial-rule (#6868)
Browse files Browse the repository at this point in the history
improve make-trivial-rule duplicate heuristic
add comment block for nonfunctional hosts
  • Loading branch information
J0WI authored and Hainish committed Oct 21, 2016
1 parent e4f0050 commit 028a42f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/chrome/content/rules/make-trivial-rule
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@ fi

lower=$(echo "$1" | tr A-Z a-z)
escaped=$(echo "$lower" | sed 's/\./\\./g' )

duplicate=$(grep -EHin '<target\s+host="(w+\.)?'$escaped'"\s*/>' *.xml)
if [ -n "$duplicate" ]
then
echo "error: $lower already exists:" >&2
echo "$duplicate" >&2
exit 1
fi

if [ "$#" -gt 1 ] ; then
to="$2"
else
to="www.$lower"
fi

cat > "$dest" <<END
<!--
Nonfunctional hosts in *.$lower:
h: http redirect
m: certificate mismatch
r: connection refused
s: self-signed certificate
t: timeout on https
-->
<ruleset name="$capitalized">
<target host="$lower" />
<target host="www.$lower" />
Expand Down

0 comments on commit 028a42f

Please sign in to comment.