printing: drop pcap_cache_loaded() guard around load_printers()
[Samba.git] / testprogs / blackbox / upgradeprovision-oldrelease.sh
blob762761680112334e4d2cbdd07d378e623e4856f2
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 $PYTHON $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 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb $@
63 dbcheck_clean() {
64 $PYTHON $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 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
72 dbcheck_full_clean() {
73 $PYTHON $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 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@
81 upgradeprovision() {
82 # bring the really old Samba schema in line with a more recent 2008R2 schema
83 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange
85 # on top of this, also apply 2008R2 changes we accidentally missed in the past
86 $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
88 # add missing domain prep for 2008R2
89 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --domain --function-level 2008_R2
92 upgradeprovision_full() {
93 # add missing domain prep for 2008R2
94 $PYTHON $BINDIR/samba-tool domain functionalprep -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --domain --function-level 2008_R2
96 $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange
99 samba_upgradedns() {
100 $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf"
103 referenceprovision() {
104 $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
107 ldapcmp() {
108 if [ x$RELEASE != x"alpha13" ]; then
109 $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
113 ldapcmp_full() {
114 $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
117 ldapcmp_sd() {
118 $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
121 ldapcmp_full_sd() {
122 $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
125 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
126 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
129 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
130 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
133 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
134 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
137 if [ -d $release_dir ]; then
138 testit $RELEASE undump
139 testit "remove_dns_user" remove_dns_user
140 testit "upgradeprovision" upgradeprovision
141 testit "upgradeprovision_full" upgradeprovision_full
142 testit "reindex" reindex
143 testit_expect_failure "dbcheck" dbcheck
144 testit_expect_failure "dbcheck_full" dbcheck_full
145 testit "dbcheck_clean" dbcheck_clean
146 testit "dbcheck_full_clean" dbcheck_full_clean
147 testit "dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls
148 testit "referenceprovision" referenceprovision
149 testit "samba_upgradedns" samba_upgradedns
150 testit "ldapcmp" ldapcmp
151 testit "ldapcmp_sd" ldapcmp_sd
152 testit "ldapcmp_full_sd" ldapcmp_full_sd
153 else
154 subunit_start_test "${RELEASE}"
155 subunit_skip_test "${RELEASE}" <<EOF
156 no test provision
159 subunit_start_test "remove_dns_user"
160 subunit_skip_test "remove_dns_user" <<EOF
161 no test provision
164 subunit_start_test "upgradeprovision"
165 subunit_skip_test "upgradeprovision" <<EOF
166 no test provision
168 subunit_start_test "upgradeprovision_full"
169 subunit_skip_test "upgradeprovision_full" <<EOF
170 no test provision
172 subunit_start_test "reindex"
173 subunit_skip_test "reindex" <<EOF
174 no test provision
176 subunit_start_test "dbcheck"
177 subunit_skip_test "dbcheck" <<EOF
178 no test provision
180 subunit_start_test "dbcheck_clean"
181 subunit_skip_test "dbcheck_clean" <<EOF
182 no test provision
184 # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run
185 if [ x$RELEASE != x"release-4-0-0" ]; then
186 subunit_start_test "dbcheck_full"
187 subunit_skip_test "dbcheck_full" <<EOF
188 no test provision
191 subunit_start_test "dbcheck_full_clean"
192 subunit_skip_test "dbcheck_full_clean" <<EOF
193 no test provision
195 subunit_start_test "dbcheck_full_clean_well_known_acls"
196 subunit_skip_test "dbcheck_full_clean_well_known_acls" <<EOF
197 no test provision
199 subunit_start_test "samba_dnsupgrade"
200 subunit_skip_test "samba_dnsupgrade" <<EOF
201 no test provision
203 subunit_start_test "referenceprovision"
204 subunit_skip_test "referenceprovision" <<EOF
205 no test provision
207 subunit_start_test "ldapcmp"
208 subunit_skip_test "ldapcmp" <<EOF
209 no test provision
211 subunit_start_test "ldapcmp_full"
212 subunit_skip_test "ldapcmp_full" <<EOF
213 no test provision
215 subunit_start_test "ldapcmp_sd"
216 subunit_skip_test "ldapcmp_sd" <<EOF
217 no test provision
219 subunit_start_test "ldapcmp_full_sd"
220 subunit_skip_test "ldapcmp_full_sd" <<EOF
221 no test provision
225 if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then
226 rm -fr $PREFIX_ABS/${RELEASE}_upgrade
229 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then
230 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full
233 if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then
234 rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference
237 exit $failed