5 Usage: upgradeprovision-oldrelease.sh PREFIX RELEASE
16 . $
(dirname $0)/subunit.sh
17 . $
(dirname $0)/common_test_fns.inc
19 release_dir
="$SRCDIR_ABS/source4/selftest/provisions/${RELEASE}"
21 ldbdel
=$
(system_or_builddir_binary ldbdel
"${BINDIR}")
22 samba_tdbrestore
=$
(system_or_builddir_binary tdbrestore
"${BINDIR}")
24 samba_undump
="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
25 if [ ! -x $samba_undump ] ||
[ ! -d $release_dir ]; then
26 subunit_start_test
"${RELEASE}"
27 subunit_skip_test
"${RELEASE}" <<EOF
31 subunit_start_test
"remove_dns_user"
32 subunit_skip_test
"remove_dns_user" <<EOF
36 subunit_start_test
"upgradeprovision"
37 subunit_skip_test
"upgradeprovision" <<EOF
40 subunit_start_test
"upgradeprovision_full"
41 subunit_skip_test
"upgradeprovision_full" <<EOF
44 subunit_start_test
"reindex"
45 subunit_skip_test
"reindex" <<EOF
48 subunit_start_test
"dbcheck"
49 subunit_skip_test
"dbcheck" <<EOF
52 subunit_start_test
"dbcheck_clean"
53 subunit_skip_test
"dbcheck_clean" <<EOF
56 # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run
57 if [ x
$RELEASE != x
"release-4-0-0" ]; then
58 subunit_start_test
"dbcheck_full"
59 subunit_skip_test
"dbcheck_full" <<EOF
63 subunit_start_test
"dbcheck_full_clean"
64 subunit_skip_test
"dbcheck_full_clean" <<EOF
67 subunit_start_test
"dbcheck_full_clean_well_known_acls"
68 subunit_skip_test
"dbcheck_full_clean_well_known_acls" <<EOF
71 subunit_start_test
"samba_dnsupgrade"
72 subunit_skip_test
"samba_dnsupgrade" <<EOF
75 subunit_start_test
"referenceprovision"
76 subunit_skip_test
"referenceprovision" <<EOF
79 subunit_start_test
"ldapcmp"
80 subunit_skip_test
"ldapcmp" <<EOF
83 subunit_start_test
"ldapcmp_full"
84 subunit_skip_test
"ldapcmp_full" <<EOF
87 subunit_start_test
"ldapcmp_sd"
88 subunit_skip_test
"ldapcmp_sd" <<EOF
91 subunit_start_test
"ldapcmp_full_sd"
92 subunit_skip_test
"ldapcmp_full_sd" <<EOF
101 $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade
$samba_tdbrestore
102 $samba_undump $release_dir $PREFIX_ABS/${RELEASE}_upgrade_full
$samba_tdbrestore
104 cp -a $release_dir/private
/*.keytab
$PREFIX_ABS/${RELEASE}_upgrade
/private
/
105 cp -a $release_dir/sysvol
$PREFIX_ABS/${RELEASE}_upgrade
/
106 mkdir
$PREFIX_ABS/${RELEASE}_upgrade
/etc
/
107 sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade|g" $release_dir/etc
/smb.conf.template \
108 >$PREFIX_ABS/${RELEASE}_upgrade
/etc
/smb.conf
110 cp -a $release_dir/private
/*.keytab
$PREFIX_ABS/${RELEASE}_upgrade_full
/private
/
111 cp -a $release_dir/sysvol
$PREFIX_ABS/${RELEASE}_upgrade_full
/
112 mkdir
$PREFIX_ABS/${RELEASE}_upgrade_full
/etc
/
113 sed -e "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" $release_dir/etc
/smb.conf.template \
114 >$PREFIX_ABS/${RELEASE}_upgrade_full
/etc
/smb.conf
119 if [ x
$RELEASE != x
"release-4-0-0" ]; then
120 # This is done, because otherwise the upgrdeprovision will not run without --full
121 ${ldbdel} -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba
,dc=corp
127 $PYTHON $BINDIR/samba-tool dbcheck
--reindex -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb
"$@"
130 # This should 'fail', because it returns the number of modified records
133 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb
"$@"
138 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb
"$@"
141 # This should 'fail', because it returns the number of modified records
144 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade_full
/private
/sam.ldb
"$@"
149 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade_full
/private
/sam.ldb
"$@"
152 # This checks that after the upgrade, the well known ACLs are correct, so this reset should not want to do anything
153 dbcheck_full_clean_well_known_acls
()
155 $PYTHON $BINDIR/samba-tool dbcheck
--reset-well-known-acls --cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}_upgrade_full
/private
/sam.ldb
"$@"
160 # bring the really old Samba schema in line with a more recent 2008R2 schema
161 $PYTHON $BINDIR/samba_upgradeprovision
--configfile="$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange
163 # on top of this, also apply 2008R2 changes we accidentally missed in the past
164 $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
166 # add missing domain prep for 2008R2
167 $PYTHON $BINDIR/samba-tool domain functionalprep
-H tdb
://$PREFIX_ABS/${RELEASE}_upgrade
/private
/sam.ldb
--domain --function-level 2008_R2
170 upgradeprovision_full
()
172 # add missing domain prep for 2008R2
173 $PYTHON $BINDIR/samba-tool domain functionalprep
-H tdb
://$PREFIX_ABS/${RELEASE}_upgrade_full
/private
/sam.ldb
--domain --function-level 2008_R2
175 $PYTHON $BINDIR/samba_upgradeprovision
--configfile="$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange
180 $PYTHON $BINDIR/samba_upgradedns
--dns-backend=SAMBA_INTERNAL
--configfile="$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf"
185 $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
190 if [ x
$RELEASE != x
"alpha13" ]; then
191 $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
,msDS-SupportedEncryptionTypes
,servicePrincipalName
197 $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
,servicePrincipalName
--skip-missing-dn
202 $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
207 $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
210 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade
211 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade_full
212 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade_reference
214 testit
$RELEASE undump || failed
=$
(expr $failed + 1)
215 testit
"remove_dns_user" remove_dns_user || failed
=$
(expr $failed + 1)
216 testit
"upgradeprovision" upgradeprovision || failed
=$
(expr $failed + 1)
217 testit
"upgradeprovision_full" upgradeprovision_full || failed
=$
(expr $failed + 1)
218 testit
"reindex" reindex || failed
=$
(expr $failed + 1)
219 testit_expect_failure
"dbcheck" dbcheck || failed
=$
(expr $failed + 1)
220 testit_expect_failure
"dbcheck_full" dbcheck_full || failed
=$
(expr $failed + 1)
221 testit
"dbcheck_clean" dbcheck_clean || failed
=$
(expr $failed + 1)
222 testit
"dbcheck_full_clean" dbcheck_full_clean || failed
=$
(expr $failed + 1)
223 testit
"dbcheck_full_clean_well_known_acls" dbcheck_full_clean_well_known_acls || failed
=$
(expr $failed + 1)
224 testit
"referenceprovision" referenceprovision || failed
=$
(expr $failed + 1)
225 testit
"samba_upgradedns" samba_upgradedns || failed
=$
(expr $failed + 1)
226 testit
"ldapcmp" ldapcmp || failed
=$
(expr $failed + 1)
227 testit
"ldapcmp_sd" ldapcmp_sd || failed
=$
(expr $failed + 1)
228 testit
"ldapcmp_full_sd" ldapcmp_full_sd || failed
=$
(expr $failed + 1)
230 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade
231 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade_full
232 remove_directory
$PREFIX_ABS/${RELEASE}_upgrade_reference