Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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