dsdb-repl_meta_data: Move TODO comment about conflicts and missing parents
[Samba/gebeck_regimport.git] / testprogs / blackbox / upgradeprovision-oldrelease.sh
blobd12c2cf172d1800f30be987ebae615d9060bcdeb
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: dbcheck.sh PREFIX RELEASE
6 EOF
7 exit 1;
8 fi
10 PREFIX_ABS="$1"
11 RELEASE="$2"
12 shift 2
14 . `dirname $0`/subunit.sh
16 release_dir=`dirname $0`/../../source4/selftest/provisions/${RELEASE}
18 undump() {
19 if test -x $BINDIR/tdbrestore;
20 then
21 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade $BINDIR/tdbrestore
22 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full $BINDIR/tdbrestore
23 else
24 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade
25 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full
27 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade/private/
28 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade/
29 mkdir $PREFIX_ABS/${RELEASE}_upgrade/etc/
30 cat $release_dir/etc/smb.conf.template | \
31 sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" \
32 > $PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf
34 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade_full/private/
35 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade_full/
36 mkdir $PREFIX_ABS/${RELEASE}_upgrade_full/etc/
37 cat $release_dir/etc/smb.conf.template | \
38 sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" \
39 > $PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf
42 remove_dns_user() {
43 if [ x$RELEASE != x"release-4-0-0" ]; then
44 # This is done, because otherwise the upgrdeprovision will not run without --full
45 $BINDIR/ldbdel -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba,dc=corp
49 reindex() {
50 $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
53 # This should 'fail', because it returns the number of modified records
54 dbcheck() {
55 $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
58 dbcheck_clean() {
59 $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
62 # This should 'fail', because it returns the number of modified records
63 dbcheck_full() {
64 $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
67 dbcheck_full_clean() {
68 $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
71 # This checks that after the upgrade, the well known ACLs are correct, so this reset should not want to do anything
72 dbcheck_full_clean_well_known_acls() {
73 $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
76 upgradeprovision() {
77 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange
80 upgradeprovision_full() {
81 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange
84 samba_upgradedns() {
85 $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf"
88 referenceprovision() {
89 $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
92 ldapcmp() {
93 if [ x$RELEASE != x"alpha13" ]; then
94 $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
98 ldapcmp_full() {
99 $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 --skip-missing-dn
102 ldapcmp_sd() {
103 $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
106 ldapcmp_full_sd() {
107 $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
110 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
111 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
114 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
115 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
118 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
119 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
122 if [ -d $release_dir ]; then
123 testit $RELEASE undump
124 testit "remove_dns_user" remove_dns_user
125 testit "upgradeprovision" upgradeprovision
126 testit "upgradeprovision_full" upgradeprovision_full
127 testit "reindex" reindex
128 testit_expect_failure "dbcheck" dbcheck
129 testit_expect_failure "dbcheck_full" dbcheck_full
130 testit "dbcheck_clean" dbcheck_clean
131 testit "dbcheck_full_clean" dbcheck_full_clean
132 testit "dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls
133 testit "referenceprovision" referenceprovision
134 testit "samba_upgradedns" samba_upgradedns
135 testit "ldapcmp" ldapcmp
136 testit "ldapcmp_sd" ldapcmp_sd
137 testit "ldapcmp_full_sd" ldapcmp_full_sd
138 else
139 subunit_start_test "${RELEASE}"
140 subunit_skip_test "${RELEASE}" <<EOF
141 no test provision
144 subunit_start_test "remove_dns_user"
145 subunit_skip_test "remove_dns_user" <<EOF
146 no test provision
149 subunit_start_test "upgradeprovision"
150 subunit_skip_test "upgradeprovision" <<EOF
151 no test provision
153 subunit_start_test "upgradeprovision_full"
154 subunit_skip_test "upgradeprovision_full" <<EOF
155 no test provision
157 subunit_start_test "reindex"
158 subunit_skip_test "reindex" <<EOF
159 no test provision
161 subunit_start_test "dbcheck"
162 subunit_skip_test "dbcheck" <<EOF
163 no test provision
165 subunit_start_test "dbcheck_clean"
166 subunit_skip_test "dbcheck_clean" <<EOF
167 no test provision
169 # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run
170 if [ x$RELEASE != x"release-4-0-0" ]; then
171 subunit_start_test "dbcheck_full"
172 subunit_skip_test "dbcheck_full" <<EOF
173 no test provision
176 subunit_start_test "dbcheck_full_clean"
177 subunit_skip_test "dbcheck_full_clean" <<EOF
178 no test provision
180 subunit_start_test "dbcheck_full_clean_well_known_acls"
181 subunit_skip_test "dbcheck_full_clean_well_known_acls" <<EOF
182 no test provision
184 subunit_start_test "samba_dnsupgrade"
185 subunit_skip_test "samba_dnsupgrade" <<EOF
186 no test provision
188 subunit_start_test "referenceprovision"
189 subunit_skip_test "referenceprovision" <<EOF
190 no test provision
192 subunit_start_test "ldapcmp"
193 subunit_skip_test "ldapcmp" <<EOF
194 no test provision
196 subunit_start_test "ldapcmp_full"
197 subunit_skip_test "ldapcmp_full" <<EOF
198 no test provision
200 subunit_start_test "ldapcmp_sd"
201 subunit_skip_test "ldapcmp_sd" <<EOF
202 no test provision
204 subunit_start_test "ldapcmp_full_sd"
205 subunit_skip_test "ldapcmp_full_sd" <<EOF
206 no test provision
210 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
211 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
214 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
215 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
218 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
219 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
222 exit $failed