summaryrefslogtreecommitdiffstats
path: root/source4/setup/tests/blackbox_upgradeprovision.sh
blob: 7dded873c1f33b008ac9a62cd2527ba06dc097af (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh

if [ $# -lt 1 ]; then
	cat <<EOF
Usage: blackbox_upgradeprovision.sh PREFIX
EOF
	exit 1
fi

PREFIX="$1"
shift 1

. $(dirname $0)/../../../testprogs/blackbox/subunit.sh

[ ! -d $PREFIX ] && mkdir $PREFIX

upgradeprovision_reference()
{
	if [ -d $PREFIX/upgradeprovision_reference ]; then
		rm -fr $PREFIX/upgradeprovision_reference
	fi
	$PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision_reference" --server-role="dc" --use-ntvfs --base-schema=2008_R2
}

upgradeprovision()
{
	if [ -d $PREFIX/upgradeprovision ]; then
		rm -fr $PREFIX/upgradeprovision
	fi
	$PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision" --server-role="dc" --use-ntvfs --base-schema=2008_R2
	$PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX/upgradeprovision/etc/smb.conf" --debugchange
}

upgradeprovision_full()
{
	if [ -d $PREFIX/upgradeprovision_full ]; then
		rm -fr $PREFIX/upgradeprovision_full
	fi
	$PYTHON $BINDIR/samba-tool domain provision --host-name=bar --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/upgradeprovision_full" --server-role="dc" --use-ntvfs --base-schema=2008_R2
	$PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX/upgradeprovision_full/etc/smb.conf" --full --debugchange
}

# The ldapcmp runs here are to ensure that a 'null' run of
# upgradeprovision (because we did a provision with the same template)
# really doesn't change anything.

ldapcmp()
{
	$PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --skip-missing-dn --filter=servicePrincipalName
}

ldapcmp_full()
{
	$PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision_full/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --skip-missing-dn --filter=servicePrincipalName
}

ldapcmp_sd()
{
	$PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --sd --skip-missing-dn --filter=servicePrincipalName
}

ldapcmp_full_sd()
{
	$PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX/upgradeprovision_full/private/sam.ldb tdb://$PREFIX/upgradeprovision_reference/private/sam.ldb --two --sd --skip-missing-dn --filter=servicePrincipalName
}

testit "upgradeprovision" upgradeprovision
testit "upgradeprovision_full" upgradeprovision_full
testit "upgradeprovision_reference" upgradeprovision_reference
testit "ldapcmp" ldapcmp
testit "ldapcmp_full" ldapcmp_full
testit "ldapcmp_sd" ldapcmp_sd
testit "ldapcmp_full_sd" ldapcmp_full_sd

if [ -d $PREFIX/upgradeprovision ]; then
	rm -fr $PREFIX/upgradeprovision
fi

if [ -d $PREFIX/upgradeprovision_full ]; then
	rm -fr $PREFIX/upgradeprovision_full
fi

if [ -d $PREFIX/upgradeprovision_reference ]; then
	rm -fr $PREFIX/upgradeprovision_reference
fi

exit $failed