s4-s3-upgrade Improve samba-tool domain samba3upgrade behaviour
[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$EXEEXT"
15 testparm="$samba4bindir/testparm$EXEEXT"
16
17 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
18
19 rm -rf $PREFIX/samba3-upgrade
20 mkdir -p $PREFIX/samba3-upgrade
21 cp -a $SRCDIR/testdata/samba3 $PREFIX/samba3-upgrade
22
23 # Test 1 (s3 member)
24 cat - > $PREFIX/samba3-upgrade/samba3/smb1.conf <<EOF
25 [global]
26    workgroup = SAMBA
27    security = user
28    netbiosname = S3UPGRADE
29    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
30    private dir = $PREFIX/samba3-upgrade/samba3
31    lock directory = $PREFIX/samba3-upgrade/samba3
32    state directory = $PREFIX/samba3-upgrade/samba3
33    cache directory = $PREFIX/samba3-upgrade/samba3
34    pid directory = $PREFIX/samba3-upgrade/samba3
35    usershare path = $PREFIX/samba3-upgrade/samba3
36    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
37
38    debug level = 0
39 EOF
40
41 testit "samba3-upgrade-member" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb1.conf --targetdir=$PREFIX/samba3-upgrade/s4_1 --libdir=$PREFIX/samba3-upgrade/samba3
42
43 # Test 2 (s3 dc)
44 cat - > $PREFIX/samba3-upgrade/samba3/smb2.conf <<EOF
45 [global]
46    workgroup = SAMBA
47    netbiosname = S3UPGRADE
48    security = user
49    realm = s3.samba.example.com
50    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
51    private dir = $PREFIX/samba3-upgrade/samba3
52    lock directory = $PREFIX/samba3-upgrade/samba3
53    state directory = $PREFIX/samba3-upgrade/samba3
54    cache directory = $PREFIX/samba3-upgrade/samba3
55    pid directory = $PREFIX/samba3-upgrade/samba3
56    usershare path = $PREFIX/samba3-upgrade/samba3
57    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
58    debug level = 0
59    domain logons = yes
60 EOF
61
62 testit "samba3-upgrade-dc" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_2 --libdir=$PREFIX/samba3-upgrade/samba3
63
64 # Test 3 (s3 dc using testparm hook)
65 cat - > $PREFIX/samba3-upgrade/samba3/smb3.conf <<EOF
66 [global]
67    workgroup = SAMBA
68    netbiosname = S3UPGRADE
69    security = user
70    realm = s3.samba.example.com
71    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
72    private dir = $PREFIX/samba3-upgrade/samba3
73    lock directory = $PREFIX/samba3-upgrade/samba3
74    state directory = $PREFIX/samba3-upgrade/samba3
75    cache directory = $PREFIX/samba3-upgrade/samba3
76    pid directory = $PREFIX/samba3-upgrade/samba3
77    usershare path = $PREFIX/samba3-upgrade/samba3
78    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
79    debug level = 0
80    domain logons = yes
81 EOF
82
83 testit "samba3-upgrade-testparm" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_3 --testparm=$testparm
84
85 rm -rf $PREFIX/samba3-upgrade
86
87 exit $failed