s4-s3upgrade: Add my wins.dat and fix the parsing error
[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 samba3upgrade $PREFIX/samba3-upgrade/samba3/smb1.conf --targetdir=$PREFIX/samba3-upgrade/s4_1 --dbdir=$PREFIX/samba3-upgrade/samba3
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 testit "samba3-upgrade-dc" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_2 --dbdir=$PREFIX/samba3-upgrade/samba3
67 testit "samba3-upgrade-dc-getlocalsid" $samba_net getlocalsid samba -s $PREFIX/samba3-upgrade/s4_2/etc/smb.conf
68 testit "samba3-upgrade-dc-getdomainsid" $samba_net getdomainsid -s $PREFIX/samba3-upgrade/s4_2/etc/smb.conf
69
70 #Run final test without a wins.dat
71 rm -f $PREFIX/samba3-upgrade/samba3/wins.dat
72
73 # Test 3 (s3 dc using testparm hook)
74 cat - > $PREFIX/samba3-upgrade/samba3/smb3.conf <<EOF
75 [global]
76    workgroup = SAMBA
77    netbiosname = S3UPGRADE
78    security = user
79    realm = s3.samba.example.com
80    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
81    private dir = $PREFIX/samba3-upgrade/samba3
82    lock directory = $PREFIX/samba3-upgrade/samba3
83    state directory = $PREFIX/samba3-upgrade/samba3
84    cache directory = $PREFIX/samba3-upgrade/samba3
85    pid directory = $PREFIX/samba3-upgrade/samba3
86    usershare path = $PREFIX/samba3-upgrade/samba3
87    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
88    debug level = 0
89    domain logons = yes
90 EOF
91
92 testit "samba3-upgrade-testparm" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_3 --testparm=$testparm
93 testit "samba3-upgrade-testparm-getlocalsid" $samba_net getlocalsid samba -s $PREFIX/samba3-upgrade/s4_3/etc/smb.conf
94 testit "samba3-upgrade-testparm-getdomainsid" $samba_net getdomainsid -s $PREFIX/samba3-upgrade/s4_3/etc/smb.conf
95
96 rm -rf $PREFIX/samba3-upgrade
97
98 exit $failed