5 Usage: dbcheck.sh PREFIX RELEASE
14 .
`dirname $0`/subunit.sh
16 release_dir
=`dirname $0`/..
/..
/source4/selftest
/provisions
/${RELEASE}
19 if [ -x "$BINDIR/ldbdel" ]; then
20 LDBDEL_BIN
=$BINDIR/ldbdel
24 if test -x $BINDIR/tdbrestore
;
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
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
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
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
60 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb $@
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
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 $@
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
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
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
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
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
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
154 subunit_start_test
"${RELEASE}"
155 subunit_skip_test
"${RELEASE}" <<EOF
159 subunit_start_test
"remove_dns_user"
160 subunit_skip_test
"remove_dns_user" <<EOF
164 subunit_start_test
"upgradeprovision"
165 subunit_skip_test
"upgradeprovision" <<EOF
168 subunit_start_test
"upgradeprovision_full"
169 subunit_skip_test
"upgradeprovision_full" <<EOF
172 subunit_start_test
"reindex"
173 subunit_skip_test
"reindex" <<EOF
176 subunit_start_test
"dbcheck"
177 subunit_skip_test
"dbcheck" <<EOF
180 subunit_start_test
"dbcheck_clean"
181 subunit_skip_test
"dbcheck_clean" <<EOF
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
191 subunit_start_test
"dbcheck_full_clean"
192 subunit_skip_test
"dbcheck_full_clean" <<EOF
195 subunit_start_test
"dbcheck_full_clean_well_known_acls"
196 subunit_skip_test
"dbcheck_full_clean_well_known_acls" <<EOF
199 subunit_start_test
"samba_dnsupgrade"
200 subunit_skip_test
"samba_dnsupgrade" <<EOF
203 subunit_start_test
"referenceprovision"
204 subunit_skip_test
"referenceprovision" <<EOF
207 subunit_start_test
"ldapcmp"
208 subunit_skip_test
"ldapcmp" <<EOF
211 subunit_start_test
"ldapcmp_full"
212 subunit_skip_test
"ldapcmp_full" <<EOF
215 subunit_start_test
"ldapcmp_sd"
216 subunit_skip_test
"ldapcmp_sd" <<EOF
219 subunit_start_test
"ldapcmp_full_sd"
220 subunit_skip_test
"ldapcmp_full_sd" <<EOF
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