summaryrefslogtreecommitdiffstats
path: root/source4/scripting/devel/drs/revampire_ad.sh
blob: cd3164ca131b2d7d594929e694885efe4e74c3c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

set -x

. $(dirname $0)/vars

$(dirname $0)/vampire_ad.sh || exit 1

ntds_guid=$(sudo bin/ldbsearch -H $PREFIX/private/sam.ldb -b "CN=NTDS Settings,CN=$machine,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,$dn" objectGUID | grep ^objectGUID | awk '{print $2}')

cp $PREFIX/private/$DNSDOMAIN.zone{.template,}
sed -i "s/NTDSGUID/$ntds_guid/g" $PREFIX/private/$DNSDOMAIN.zone
cp $PREFIX/private/named.conf{.local,}
sudo rndc reconfig
fsmotmp=$(mktemp fsmo.ldif.XXXXXXXXX)
cp $(dirname $0)/fsmo.ldif.template $fsmotmp
sed -i "s/NTDSGUID/$ntds_guid/g" $fsmotmp
sed -i "s/MACHINE/$machine/g" $fsmotmp
sed -i "s/DNSDOMAIN/$DNSDOMAIN/g" $fsmotmp
sed -i "s/BASEDN/$dn/g" $fsmotmp
sed -i "s/NETBIOSDOMAIN/$workgroup/g" $fsmotmp
sudo bin/ldbmodify -H $PREFIX/private/sam.ldb $fsmotmp
rm $fsmotmp