1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/source4/scripting/devel/drs/revampire_ad.sh
Andreas Schneider 8e2f5020cd s4:scripting: Reformat shell scripts
shfmt -f source4/scripting/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-07-08 09:05:56 +00:00

24 lines
817 B
Bash
Executable File

#!/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