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 $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 $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb $@
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
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 $@
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
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
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
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
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
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
144 subunit_start_test
"${RELEASE}"
145 subunit_skip_test
"${RELEASE}" <<EOF
149 subunit_start_test
"remove_dns_user"
150 subunit_skip_test
"remove_dns_user" <<EOF
154 subunit_start_test
"upgradeprovision"
155 subunit_skip_test
"upgradeprovision" <<EOF
158 subunit_start_test
"upgradeprovision_full"
159 subunit_skip_test
"upgradeprovision_full" <<EOF
162 subunit_start_test
"reindex"
163 subunit_skip_test
"reindex" <<EOF
166 subunit_start_test
"dbcheck"
167 subunit_skip_test
"dbcheck" <<EOF
170 subunit_start_test
"dbcheck_clean"
171 subunit_skip_test
"dbcheck_clean" <<EOF
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
181 subunit_start_test
"dbcheck_full_clean"
182 subunit_skip_test
"dbcheck_full_clean" <<EOF
185 subunit_start_test
"dbcheck_full_clean_well_known_acls"
186 subunit_skip_test
"dbcheck_full_clean_well_known_acls" <<EOF
189 subunit_start_test
"samba_dnsupgrade"
190 subunit_skip_test
"samba_dnsupgrade" <<EOF
193 subunit_start_test
"referenceprovision"
194 subunit_skip_test
"referenceprovision" <<EOF
197 subunit_start_test
"ldapcmp"
198 subunit_skip_test
"ldapcmp" <<EOF
201 subunit_start_test
"ldapcmp_full"
202 subunit_skip_test
"ldapcmp_full" <<EOF
205 subunit_start_test
"ldapcmp_sd"
206 subunit_skip_test
"ldapcmp_sd" <<EOF
209 subunit_start_test
"ldapcmp_full_sd"
210 subunit_skip_test
"ldapcmp_full_sd" <<EOF
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