-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxlator.sh.in
73 lines (68 loc) · 1.45 KB
/
xlator.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# (c) 2008, Quest Software Inc. All rights reserved.
#
# A VGP xlator
# install as /opt/quest/libexec/vgp/xlators/Machine/quest-dnsupdate
SAVEDIR=/var/opt/quest/vgp/exts/admext/quest-dnsupdate
CONF="@sysconfdir@/dnsupdate.conf"
CONFTMP=/tmp/.$$dnsupdate.conf.tmp
#-- When run with -test flag, write to /tmp
case $1 in
-test)
shift
SAVEDIR=/tmp/savedir
CONF=/tmp/dnsupdate.conf
mkdir -p $SAVEDIR
;;
esac
case $1 in
info)
cat <<-.
INFO: $0
This translator configures quest-dnsupdate in accordance with
the policies defined for Microsoft DNS Client.
.
;;
keys)
cat <<-'.'
Software\Policies\Microsoft\Windows NT\DNSClient
.
;;
init)
if test -r $CONF; then
# Remove lines in the config file previously from this translator
sed -e '/^#--VGP BEGIN--#/,/^#--VGP END--#/d' < $CONF > $CONFTMP
if test -s $CONFTMP; then
cat $CONFTMP > $CONF
else
rm -f $CONF
fi
fi
rm -f $CONFTMP
;;
"")
# Append all DNSClient keys to the dnsupdate.conf file
: > $CONFTMP.2
IFS=\;
while read REG_KEY VALUE_NAME DATA_TYPE VALUE
do
case $VALUE_NAME:$DATA_TYPE in
*:*) echo "$VALUE_NAME = $VALUE" >> $CONFTMP.2;;
esac
done
if test -s $CONFTMP.2; then
{ test -s $CONF && cat $CONF
echo '#--VGP BEGIN--#'
sort < $CONFTMP.2
echo '#--VGP END--#'
} > $CONFTMP.3
cat $CONFTMP.3 > $CONF
fi
rm -f $CONFTMP.2 $CONFTMP.3
;;
*)
echo "unknown argument '$1'" >&2
exit 1
;;
esac
: