dab3754048537472bfdf9f20663db0cd420df2b1
[samba.git] / source4 / setup / tests / blackbox_s3upgrade.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: blackbox_s3upgrade.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX=`pwd`"/$1"
11 shift 1
12
13 samba4bindir="$BINDIR"
14 samba_tool="$samba4bindir/samba-tool"
15 samba_net="$samba4bindir/net"
16 testparm="$samba4bindir/testparm"
17
18 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
19
20 rm -rf $PREFIX/samba3-upgrade
21 mkdir -p $PREFIX/samba3-upgrade
22 cp -a $SRCDIR/testdata/samba3 $PREFIX/samba3-upgrade
23
24 # Test 1 (s3 member)
25 cat - > $PREFIX/samba3-upgrade/samba3/smb1.conf <<EOF
26 [global]
27    workgroup = SAMBA
28    security = user
29    netbiosname = S3UPGRADE
30    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
31    private dir = $PREFIX/samba3-upgrade/samba3
32    lock directory = $PREFIX/samba3-upgrade/samba3
33    state directory = $PREFIX/samba3-upgrade/samba3
34    cache directory = $PREFIX/samba3-upgrade/samba3
35    pid directory = $PREFIX/samba3-upgrade/samba3
36    usershare path = $PREFIX/samba3-upgrade/samba3
37    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
38
39    debug level = 0
40 EOF
41
42 testit "samba3-upgrade-member" $samba_tool domain classicupgrade $PREFIX/samba3-upgrade/samba3/smb1.conf --targetdir=$PREFIX/samba3-upgrade/s4_1 --dbdir=$PREFIX/samba3-upgrade/samba3 --use-ntvfs
43 testit "samba3-upgrade-member-getlocalsid" $samba_net getlocalsid s3upgrade -s $PREFIX/samba3-upgrade/s4_1/etc/smb.conf
44
45 # Test 2 (s3 dc)
46 cat - > $PREFIX/samba3-upgrade/samba3/smb2.conf <<EOF
47 [global]
48    workgroup = SAMBA
49    netbiosname = S3UPGRADE
50    security = user
51    realm = s3.samba.example.com
52    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
53    private dir = $PREFIX/samba3-upgrade/samba3
54    lock directory = $PREFIX/samba3-upgrade/samba3
55    state directory = $PREFIX/samba3-upgrade/samba3
56    cache directory = $PREFIX/samba3-upgrade/samba3
57    pid directory = $PREFIX/samba3-upgrade/samba3
58    usershare path = $PREFIX/samba3-upgrade/samba3
59    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
60    debug level = 0
61    domain logons = yes
62 EOF
63
64 mv $PREFIX/samba3-upgrade/samba3/wins.dat2 $PREFIX/samba3-upgrade/samba3/wins.dat
65
66 # Upgrade NT4-like domains in samba3upgrade
67 testit "samba3-upgrade-dc" $samba_tool domain classicupgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_2 --dbdir=$PREFIX/samba3-upgrade/samba3 --use-ntvfs
68 testit "samba3-upgrade-dc-getlocalsid" $samba_net getlocalsid samba -s $PREFIX/samba3-upgrade/s4_2/etc/smb.conf
69 testit "samba3-upgrade-dc-getdomainsid" $samba_net getdomainsid -s $PREFIX/samba3-upgrade/s4_2/etc/smb.conf
70
71 #Run final test without a wins.dat
72 rm -f $PREFIX/samba3-upgrade/samba3/wins.dat
73
74 # Test 3 (s3 dc using testparm hook)
75 cat - > $PREFIX/samba3-upgrade/samba3/smb3.conf <<EOF
76 [global]
77    workgroup = SAMBA
78    netbiosname = S3UPGRADE
79    security = user
80    realm = s3.samba.example.com
81    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
82    private dir = $PREFIX/samba3-upgrade/samba3
83    lock directory = $PREFIX/samba3-upgrade/samba3
84    state directory = $PREFIX/samba3-upgrade/samba3
85    cache directory = $PREFIX/samba3-upgrade/samba3
86    pid directory = $PREFIX/samba3-upgrade/samba3
87    usershare path = $PREFIX/samba3-upgrade/samba3
88    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
89    debug level = 0
90    domain logons = yes
91 EOF
92
93 testit "samba3-upgrade-testparm" $samba_tool domain classicupgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_3 --testparm=$testparm --use-ntvfs
94 testit "samba3-upgrade-testparm-getlocalsid" $samba_net getlocalsid samba -s $PREFIX/samba3-upgrade/s4_3/etc/smb.conf
95 testit "samba3-upgrade-testparm-getdomainsid" $samba_net getdomainsid -s $PREFIX/samba3-upgrade/s4_3/etc/smb.conf
96
97 rm -rf $PREFIX/samba3-upgrade
98
99 exit $failed