Index: 05univention-bind.inst =================================================================== --- 05univention-bind.inst (Revision 78859) +++ 05univention-bind.inst (Arbeitskopie) @@ -38,6 +38,32 @@ eval "$(univention-config-registry shell)" +dielog() { + local output + local rc + + output=$("$@" 2>&1) + rc=$? + if [ 0 -ne "$rc" ]; then + if [ -n "$ERRMSG" ]; then + echo "__ERR__: $ERRMSG" + unset ERRMSG + fi + if [ -n "$output" ]; then + echo "__ERR__: Command output:" + while read; do + echo "__ERR__: $REPLY" + done <<<"$output" + fi + echo "__ERR__: RC=$rc" + die + else + echo "$output" + fi + + return $rc +} + wait_for_dns () { if [ "$server_role" != "domaincontroller_master" ] then @@ -67,12 +93,13 @@ zone="$(univention-directory-manager dns/forward_zone list "$@" --filter zone=$domainname | grep ^DN:)" if [ -z "$zone" ]; then - /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." - if [ $? != 0 ]; then exit 1; fi + ERRMSG="Failed creating the DNS zone $domainname" + dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." fi wait_for_dns - /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add a "$hostname" "$IP" || die + ERRMSG="Failed adding the DNS host record $hostname ($IP) to zone $domainname" + dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add a "$hostname" "$IP" reversezone=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output reverse --calcdns) if [ -z "$reversezone" ]; then exit 1; fi @@ -79,9 +106,12 @@ ptr=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output pointer --calcdns) if [ -z "$ptr" ]; then exit 1; fi - /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." || die - /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add ptr "$ptr" "$hostname.$domainname." || die + ERRMSG="Failed creating the DNS reverse zone $reversezone" + dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." + ERRMSG="Failed adding the DNS ptr record $ptr ($hostname.$domainname) to zone $reversezone" + dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add ptr "$ptr" "$hostname.$domainname." + univention-config-registry set dns/master/address=127.0.0.1 dns/master/port?7777 # Append local server as DNS server to the zones, except if disabled by UCR