-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
# Author: Héctor Molinero Fernández <[email protected]> | ||
# License: MIT, https://opensource.org/licenses/MIT | ||
# Repository: https://github.com/hectorm/hblock | ||
|
||
set -eu | ||
export LC_ALL='C' | ||
|
||
main() { | ||
source="${1:?}" | ||
target="${2:?}" | ||
hblock="${3:-hblock}" | ||
|
||
# shellcheck disable=SC2155 | ||
export HBLOCK_HEADER="$(cat <<-'EOF' | ||
$TTL 2h | ||
@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h) | ||
IN NS localhost. | ||
EOF | ||
)" | ||
export HBLOCK_FOOTER='' | ||
export HBLOCK_SOURCES="file://${source:?}" | ||
export HBLOCK_ALLOWLIST='' | ||
export HBLOCK_DENYLIST='hblock-check.molinero.dev' | ||
|
||
export HBLOCK_REDIRECTION='.' | ||
export HBLOCK_WRAP='1' | ||
export HBLOCK_TEMPLATE='%D CNAME %R\n*.%D CNAME %R' | ||
export HBLOCK_COMMENT=';' | ||
|
||
export HBLOCK_LENIENT='false' | ||
export HBLOCK_REGEX='false' | ||
export HBLOCK_FILTER_SUBDOMAINS='true' | ||
export HBLOCK_CONTINUE='false' | ||
|
||
"${hblock:?}" -qO "${target:?}" | ||
} | ||
|
||
main "${@-}" |