s3:winbindd: call process_set_title() for locator child
[Samba.git] / testprogs / blackbox / upgradeprovision-oldrelease.sh
blobe8267ea5c1f30910b34a98d03bd78d9ab2301397
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: upgradeprovision-oldrelease.sh PREFIX RELEASE
6 EOF
7 exit 1
8 fi
10 PREFIX_ABS="$1"
11 RELEASE="$2"
12 shift 2
14 failed=0
16 . $(dirname $0)/subunit.sh
17 . $(dirname $0)/common_test_fns.inc
19 release_dir="$SRCDIR_ABS/source4/selftest/provisions/${RELEASE}"
21 ldbdel=$(system_or_builddir_binary ldbdel "${BINDIR}")
22 samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
24 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
25 if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then
26 subunit_start_test "${RELEASE}"
27 subunit_skip_test "${RELEASE}" <<EOF
28 no test provision
29 EOF
31 subunit_start_test "remove_dns_user"
32 subunit_skip_test "remove_dns_user" <<EOF
33 no test provision
34 EOF
36 subunit_start_test "upgradeprovision"
37 subunit_skip_test "upgradeprovision" <<EOF
38 no test provision
39 EOF
40 subunit_start_test "upgradeprovision_full"
41 subunit_skip_test "upgradeprovision_full" <<EOF
42 no test provision
43 EOF
44 subunit_start_test "reindex"
45 subunit_skip_test "reindex" <<EOF
46 no test provision
47 EOF
48 subunit_start_test "dbcheck"
49 subunit_skip_test "dbcheck" <<EOF
50 no test provision
51 EOF
52 subunit_start_test "dbcheck_clean"
53 subunit_skip_test "dbcheck_clean" <<EOF
54 no test provision
55 EOF
56 # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run
57 if [ x$RELEASE != x"release-4-0-0" ]; then
58 subunit_start_test "dbcheck_full"
59 subunit_skip_test "dbcheck_full" <<EOF
60 no test provision
61 EOF
63 subunit_start_test "dbcheck_full_clean"
64 subunit_skip_test "dbcheck_full_clean" <<EOF
65 no test provision
66 EOF
67 subunit_start_test "dbcheck_full_clean_well_known_acls"
68 subunit_skip_test "dbcheck_full_clean_well_known_acls" <<EOF
69 no test provision
70 EOF
71 subunit_start_test "samba_dnsupgrade"
72 subunit_skip_test "samba_dnsupgrade" <<EOF
73 no test provision
74 EOF
75 subunit_start_test "referenceprovision"
76 subunit_skip_test "referenceprovision" <<EOF
77 no test provision
78 EOF
79 subunit_start_test "ldapcmp"
80 subunit_skip_test "ldapcmp" <<EOF
81 no test provision
82 EOF
83 subunit_start_test "ldapcmp_full"
84 subunit_skip_test "ldapcmp_full" <<EOF
85 no test provision
86 EOF
87 subunit_start_test "ldapcmp_sd"
88 subunit_skip_test "ldapcmp_sd" <<EOF
89 no test provision
90 EOF
91 subunit_start_test "ldapcmp_full_sd"
92 subunit_skip_test "ldapcmp_full_sd" <<EOF
93 no test provision
94 EOF
96 exit 0
99 undump()
101 $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade $samba_tdbrestore
102 $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full $samba_tdbrestore
104 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade/private/
105 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade/
106 mkdir $PREFIX_ABS/${RELEASE}_upgrade/etc/
107 sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" $release_dir/etc/smb.conf.template \
108 >$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf
110 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade_full/private/
111 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade_full/
112 mkdir $PREFIX_ABS/${RELEASE}_upgrade_full/etc/
113 sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" $release_dir/etc/smb.conf.template \
114 >$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf
117 remove_dns_user()
119 if [ x$RELEASE != x"release-4-0-0" ]; then
120 # This is done, because otherwise the upgrdeprovision will not run without --full
121 ${ldbdel} -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba,dc=corp
125 reindex()
127 $PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb "$@"
130 # This should 'fail', because it returns the number of modified records
131 dbcheck()
133 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb "$@"
136 dbcheck_clean()
138 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb "$@"
141 # This should 'fail', because it returns the number of modified records
142 dbcheck_full()
144 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb "$@"
147 dbcheck_full_clean()
149 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb "$@"
152 # This checks that after the upgrade, the well known ACLs are correct, so this reset should not want to do anything
153 dbcheck_full_clean_well_known_acls()
155 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb "$@"
158 upgradeprovision()
160 # bring the really old Samba schema in line with a more recent 2008R2 schema
161 $PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange
163 # on top of this, also apply 2008R2 changes we accidentally missed in the past
164 $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --ldf-file=samba-4.7-missing-for-schema45.ldif,fix-forest-rev.ldf
166 # add missing domain prep for 2008R2
167 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --domain --function-level 2008_R2
170 upgradeprovision_full()
172 # add missing domain prep for 2008R2
173 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --domain --function-level 2008_R2
175 $PYTHON $BINDIR/samba_upgradeprovision --configfile="$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange
178 samba_upgradedns()
180 $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL --configfile="$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf"
183 referenceprovision()
185 $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_upgrade_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 --function-level=2003 --base-schema=2008_R2_old
188 ldapcmp()
190 if [ x$RELEASE != x"alpha13" ]; then
191 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord,displayName,msDS-SupportedEncryptionTypes,servicePrincipalName
195 ldapcmp_full()
197 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --filter=dNSProperty,dnsRecord,cn,displayName,versionNumber,systemFlags,msDS-HasInstantiatedNCs,servicePrincipalName --skip-missing-dn
200 ldapcmp_sd()
202 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --sd --skip-missing-dn
205 ldapcmp_full_sd()
207 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --sd --skip-missing-dn
210 remove_directory $PREFIX_ABS/${RELEASE}_upgrade
211 remove_directory $PREFIX_ABS/${RELEASE}_upgrade_full
212 remove_directory $PREFIX_ABS/${RELEASE}_upgrade_reference
214 testit $RELEASE undump || failed=$(expr $failed + 1)
215 testit "remove_dns_user" remove_dns_user || failed=$(expr $failed + 1)
216 testit "upgradeprovision" upgradeprovision || failed=$(expr $failed + 1)
217 testit "upgradeprovision_full" upgradeprovision_full || failed=$(expr $failed + 1)
218 testit "reindex" reindex || failed=$(expr $failed + 1)
219 testit_expect_failure "dbcheck" dbcheck || failed=$(expr $failed + 1)
220 testit_expect_failure "dbcheck_full" dbcheck_full || failed=$(expr $failed + 1)
221 testit "dbcheck_clean" dbcheck_clean || failed=$(expr $failed + 1)
222 testit "dbcheck_full_clean" dbcheck_full_clean || failed=$(expr $failed + 1)
223 testit "dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls || failed=$(expr $failed + 1)
224 testit "referenceprovision" referenceprovision || failed=$(expr $failed + 1)
225 testit "samba_upgradedns" samba_upgradedns || failed=$(expr $failed + 1)
226 testit "ldapcmp" ldapcmp || failed=$(expr $failed + 1)
227 testit "ldapcmp_sd" ldapcmp_sd || failed=$(expr $failed + 1)
228 testit "ldapcmp_full_sd" ldapcmp_full_sd || failed=$(expr $failed + 1)
230 remove_directory $PREFIX_ABS/${RELEASE}_upgrade
231 remove_directory $PREFIX_ABS/${RELEASE}_upgrade_full
232 remove_directory $PREFIX_ABS/${RELEASE}_upgrade_reference
234 exit $failed