|
38 |
|
38 |
|
39 |
eval "$(univention-config-registry shell)" |
39 |
eval "$(univention-config-registry shell)" |
40 |
|
40 |
|
|
|
41 |
dielog() { |
42 |
local output |
43 |
local rc |
44 |
|
45 |
output=$("$@" 2>&1) |
46 |
rc=$? |
47 |
if [ 0 -ne "$rc" ]; then |
48 |
if [ -n "$ERRMSG" ]; then |
49 |
echo "__ERR__: $ERRMSG" |
50 |
unset ERRMSG |
51 |
fi |
52 |
if [ -n "$output" ]; then |
53 |
echo "__ERR__: Command output:" |
54 |
while read; do |
55 |
echo "__ERR__: $REPLY" |
56 |
done <<<"$output" |
57 |
fi |
58 |
echo "__ERR__: RC=$rc" |
59 |
die |
60 |
else |
61 |
echo "$output" |
62 |
fi |
63 |
|
64 |
return $rc |
65 |
} |
66 |
|
41 |
wait_for_dns () { |
67 |
wait_for_dns () { |
42 |
if [ "$server_role" != "domaincontroller_master" ] |
68 |
if [ "$server_role" != "domaincontroller_master" ] |
43 |
then |
69 |
then |
|
67 |
zone="$(univention-directory-manager dns/forward_zone list "$@" --filter zone=$domainname | grep ^DN:)" |
93 |
zone="$(univention-directory-manager dns/forward_zone list "$@" --filter zone=$domainname | grep ^DN:)" |
68 |
|
94 |
|
69 |
if [ -z "$zone" ]; then |
95 |
if [ -z "$zone" ]; then |
70 |
/usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." |
96 |
ERRMSG="Failed creating the DNS zone $domainname" |
71 |
if [ $? != 0 ]; then exit 1; fi |
97 |
dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." |
72 |
fi |
98 |
fi |
73 |
|
99 |
|
74 |
wait_for_dns |
100 |
wait_for_dns |
75 |
/usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add a "$hostname" "$IP" || die |
101 |
ERRMSG="Failed adding the DNS host record $hostname ($IP) to zone $domainname" |
|
|
102 |
dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists "$domainname" add a "$hostname" "$IP" |
76 |
|
103 |
|
77 |
reversezone=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output reverse --calcdns) |
104 |
reversezone=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output reverse --calcdns) |
78 |
if [ -z "$reversezone" ]; then exit 1; fi |
105 |
if [ -z "$reversezone" ]; then exit 1; fi |
|
79 |
ptr=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output pointer --calcdns) |
106 |
ptr=$(univention-ipcalc6 --netmask "$NETMASK" --ip "$IP" --output pointer --calcdns) |
80 |
if [ -z "$ptr" ]; then exit 1; fi |
107 |
if [ -z "$ptr" ]; then exit 1; fi |
81 |
|
108 |
|
82 |
/usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." || die |
109 |
ERRMSG="Failed creating the DNS reverse zone $reversezone" |
83 |
/usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add ptr "$ptr" "$hostname.$domainname." || die |
110 |
dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add zone "root@$domainname." 1 28800 7200 604800 10800 "$hostname.$domainname." |
84 |
|
111 |
|
|
|
112 |
ERRMSG="Failed adding the DNS ptr record $ptr ($hostname.$domainname) to zone $reversezone" |
113 |
dielog /usr/share/univention-admin-tools/univention-dnsedit "$@" --ignore-exists --reverse "$reversezone" add ptr "$ptr" "$hostname.$domainname." |
114 |
|
85 |
univention-config-registry set dns/master/address=127.0.0.1 dns/master/port?7777 |
115 |
univention-config-registry set dns/master/address=127.0.0.1 dns/master/port?7777 |
86 |
|
116 |
|
87 |
# Append local server as DNS server to the zones, except if disabled by UCR |
117 |
# Append local server as DNS server to the zones, except if disabled by UCR |