Projects
home:rottame:yggdra_agents
dns_authoritative_provisioner
pdns_check_zone
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pdns_check_zone of Package dns_authoritative_provisioner
#!/usr/bin/bash set -euo pipefail # Source named_env if present if [ -f /etc/dns_authoritative_provisioner/pdns_env ]; then . /etc/dns_authoritative_provisioner/pdns_env fi if [ -z "$$PDNSUTIL_BIN" ]; then $PDNSUTIL_BIN="/usr/bin/pdnsutil" fi usage() { echo "Use: $0 [options] zonename filename" >&2 exit 1 } # Parse delle opzioni, ignorando tutto # : dopo la lettera = opzione con argomento while getopts ":djqvDc:f:F:J:s:t:w:k:m:n:r:i:M:S:W:o:" opt; do case "$opt" in # tutte le opzioni sono semplicemente ignorate d|j|q|v|D) ;; c|f|F|J|s|t|w|k|m|n|r|i|M|S|W|o) # getopts ha già consumato il relativo argomento, non facciamo nulla ;; :) # argomento mancante per un'opzione, gestiscilo come preferisci echo "Opzione -$OPTARG richiede un argomento" >&2 usage ;; \?) echo "Opzione sconosciuta: -$OPTARG" >&2 usage ;; esac done # Rimuove le opzioni parse dal positional parameters shift $((OPTIND - 1)) # Ora dovremmo avere: zonename [filename] [ $# -lt 1 ] && usage ZONE=$1 shift || true [ $# -lt 1 ] && usage ZONEFILE=$1 if [ -z "$ZONE" -o -z "$ZONEFILE" ] then usage fi if ! command -v $PDNSUTIL_BIN >/dev/null 2>&1; then echo "Errore: '$PDNSUTIL_BIN' non trovato nel PATH" >&2 exit 127 fi TMPDIR="$(mktemp -d /tmp/pdnscheck.XXXXXX)" cleanup() { # Evita disastri: cancella solo se è una dir sotto /tmp/pdnscheck.* if [ -n "${TMPDIR:-}" ] && [ -d "$TMPDIR" ]; then case "$TMPDIR" in /tmp/pdnscheck.*) rm -rf "$TMPDIR" ;; *) echo "ATTENZIONE: directory temporanea sospetta '$TMPDIR', non la rimuovo" >&2 ;; esac fi } trap cleanup EXIT NAMED_CONF="$TMPDIR/named.conf" PDNS_CONF="$TMPDIR/pdns.conf" PDNS_DB="$TMPDIR/bind.sqlite3" $PDNSUTIL_BIN create-bind-db "$PDNS_DB" # named.conf minimale cat >"$NAMED_CONF" <<EOF zone "$ZONE" { type master; file "$ZONEFILE"; }; EOF # pdns.conf minimale per backend BIND cat >"$PDNS_CONF" <<EOF launch=bind primary=yes bind-config=$NAMED_CONF bind-dnssec-db=$PDNS_DB daemon=no guardian=no EOF # usa solo la nostra pdns.conf temporanea $PDNSUTIL_BIN --config-dir="$TMPDIR" check-zone "$ZONE" # con set -e, lo script esce con lo stesso exit code di $PDNSUTIL_BIN
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.