Fix newuser and setpassword scripts, and port to idmap.
[samba.git] / source4 / setup / tests / blackbox_provision.sh
1 #!/bin/sh
2
3 if [ $# -lt 2 ]; then
4 cat <<EOF
5 Usage: blackbox_provision.sh PREFIX CONFIGURATION
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 CONFIGURATION="$2"
12 shift 2
13
14 testit() {
15         name="$1"
16         shift
17         cmdline="$*"
18         echo "test: $name"
19         $cmdline
20         status=$?
21         if [ x$status = x0 ]; then
22                 echo "success: $name"
23         else
24                 echo "failure: $name"
25                 failed=`expr $failed + 1`
26         fi
27         return $status
28 }
29
30 testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-default
31 testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
32 testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member
33 testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone
34 testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/blank-dc --blank
35 testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/partitions-only-dc --partitions-only
36
37 testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
38 testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass
39
40 reprovision() {
41         $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
42         $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
43 }
44
45 testit "reprovision" reprovision
46
47 exit $failed