5 Usage: dbcheck.sh PREFIX RELEASE
14 .
`dirname $0`/subunit.sh
16 release_dir
=`dirname $0`/..
/..
/source4/selftest
/provisions
/${RELEASE}
19 if test -x $BINDIR/tdbrestore
;
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
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
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
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
55 $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb $@
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
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 $@
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
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
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
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
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
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
139 subunit_start_test
"${RELEASE}"
140 subunit_skip_test
"${RELEASE}" <<EOF
144 subunit_start_test
"remove_dns_user"
145 subunit_skip_test
"remove_dns_user" <<EOF
149 subunit_start_test
"upgradeprovision"
150 subunit_skip_test
"upgradeprovision" <<EOF
153 subunit_start_test
"upgradeprovision_full"
154 subunit_skip_test
"upgradeprovision_full" <<EOF
157 subunit_start_test
"reindex"
158 subunit_skip_test
"reindex" <<EOF
161 subunit_start_test
"dbcheck"
162 subunit_skip_test
"dbcheck" <<EOF
165 subunit_start_test
"dbcheck_clean"
166 subunit_skip_test
"dbcheck_clean" <<EOF
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
176 subunit_start_test
"dbcheck_full_clean"
177 subunit_skip_test
"dbcheck_full_clean" <<EOF
180 subunit_start_test
"dbcheck_full_clean_well_known_acls"
181 subunit_skip_test
"dbcheck_full_clean_well_known_acls" <<EOF
184 subunit_start_test
"samba_dnsupgrade"
185 subunit_skip_test
"samba_dnsupgrade" <<EOF
188 subunit_start_test
"referenceprovision"
189 subunit_skip_test
"referenceprovision" <<EOF
192 subunit_start_test
"ldapcmp"
193 subunit_skip_test
"ldapcmp" <<EOF
196 subunit_start_test
"ldapcmp_full"
197 subunit_skip_test
"ldapcmp_full" <<EOF
200 subunit_start_test
"ldapcmp_sd"
201 subunit_skip_test
"ldapcmp_sd" <<EOF
204 subunit_start_test
"ldapcmp_full_sd"
205 subunit_skip_test
"ldapcmp_full_sd" <<EOF
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