tevent: version 0.9.35
[Samba.git] / testprogs / blackbox / upgradeprovision-oldrelease.sh
blob26807be22c3c2a008972be93ca48770ff4f32dee
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 LDBDEL_BIN=ldbdel
19 if [ -x "$BINDIR/ldbdel" ]; then
20 LDBDEL_BIN=$BINDIR/ldbdel
23 undump() {
24 if test -x $BINDIR/tdbrestore;
25 then
26 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade $BINDIR/tdbrestore
27 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full $BINDIR/tdbrestore
28 else
29 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade
30 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full
32 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade/private/
33 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade/
34 mkdir $PREFIX_ABS/${RELEASE}_upgrade/etc/
35 cat $release_dir/etc/smb.conf.template | \
36 sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" \
37 > $PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf
39 cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade_full/private/
40 cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade_full/
41 mkdir $PREFIX_ABS/${RELEASE}_upgrade_full/etc/
42 cat $release_dir/etc/smb.conf.template | \
43 sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" \
44 > $PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf
47 remove_dns_user() {
48 if [ x$RELEASE != x"release-4-0-0" ]; then
49 # This is done, because otherwise the upgrdeprovision will not run without --full
50 ${LDBDEL_BIN} -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba,dc=corp
54 reindex() {
55 $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
58 # This should 'fail', because it returns the number of modified records
59 dbcheck() {
60 $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
63 dbcheck_clean() {
64 $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
67 # This should 'fail', because it returns the number of modified records
68 dbcheck_full() {
69 $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
72 dbcheck_full_clean() {
73 $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
76 # This checks that after the upgrade, the well known ACLs are correct, so this reset should not want to do anything
77 dbcheck_full_clean_well_known_acls() {
78 $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
81 upgradeprovision() {
82 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange
85 upgradeprovision_full() {
86 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange
89 samba_upgradedns() {
90 $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf"
93 referenceprovision() {
94 $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
97 ldapcmp() {
98 if [ x$RELEASE != x"alpha13" ]; then
99 $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
103 ldapcmp_full() {
104 $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
107 ldapcmp_sd() {
108 $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
111 ldapcmp_full_sd() {
112 $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
115 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
116 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
119 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
120 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
123 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
124 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
127 if [ -d $release_dir ]; then
128 testit $RELEASE undump
129 testit "remove_dns_user" remove_dns_user
130 testit "upgradeprovision" upgradeprovision
131 testit "upgradeprovision_full" upgradeprovision_full
132 testit "reindex" reindex
133 testit_expect_failure "dbcheck" dbcheck
134 testit_expect_failure "dbcheck_full" dbcheck_full
135 testit "dbcheck_clean" dbcheck_clean
136 testit "dbcheck_full_clean" dbcheck_full_clean
137 testit "dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls
138 testit "referenceprovision" referenceprovision
139 testit "samba_upgradedns" samba_upgradedns
140 testit "ldapcmp" ldapcmp
141 testit "ldapcmp_sd" ldapcmp_sd
142 testit "ldapcmp_full_sd" ldapcmp_full_sd
143 else
144 subunit_start_test "${RELEASE}"
145 subunit_skip_test "${RELEASE}" <<EOF
146 no test provision
149 subunit_start_test "remove_dns_user"
150 subunit_skip_test "remove_dns_user" <<EOF
151 no test provision
154 subunit_start_test "upgradeprovision"
155 subunit_skip_test "upgradeprovision" <<EOF
156 no test provision
158 subunit_start_test "upgradeprovision_full"
159 subunit_skip_test "upgradeprovision_full" <<EOF
160 no test provision
162 subunit_start_test "reindex"
163 subunit_skip_test "reindex" <<EOF
164 no test provision
166 subunit_start_test "dbcheck"
167 subunit_skip_test "dbcheck" <<EOF
168 no test provision
170 subunit_start_test "dbcheck_clean"
171 subunit_skip_test "dbcheck_clean" <<EOF
172 no test provision
174 # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run
175 if [ x$RELEASE != x"release-4-0-0" ]; then
176 subunit_start_test "dbcheck_full"
177 subunit_skip_test "dbcheck_full" <<EOF
178 no test provision
181 subunit_start_test "dbcheck_full_clean"
182 subunit_skip_test "dbcheck_full_clean" <<EOF
183 no test provision
185 subunit_start_test "dbcheck_full_clean_well_known_acls"
186 subunit_skip_test "dbcheck_full_clean_well_known_acls" <<EOF
187 no test provision
189 subunit_start_test "samba_dnsupgrade"
190 subunit_skip_test "samba_dnsupgrade" <<EOF
191 no test provision
193 subunit_start_test "referenceprovision"
194 subunit_skip_test "referenceprovision" <<EOF
195 no test provision
197 subunit_start_test "ldapcmp"
198 subunit_skip_test "ldapcmp" <<EOF
199 no test provision
201 subunit_start_test "ldapcmp_full"
202 subunit_skip_test "ldapcmp_full" <<EOF
203 no test provision
205 subunit_start_test "ldapcmp_sd"
206 subunit_skip_test "ldapcmp_sd" <<EOF
207 no test provision
209 subunit_start_test "ldapcmp_full_sd"
210 subunit_skip_test "ldapcmp_full_sd" <<EOF
211 no test provision
215 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
216 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
219 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
220 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
223 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
224 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
227 exit $failed