#!/bin/sh # Build a test environment for running Samba if [ $# -lt 1 ] then echo "$0 PREFIX" exit 1 fi PREFIX=$1 if test -z "$SHARE_BACKEND"; then SHARE_BACKEND=classic fi if test -z "$SMBD_LOGLEVEL"; then SMBD_LOGLEVEL=1 fi SERVER_ROLE="domain controller" DOMAIN=SAMBADOMAIN USERNAME=administrator REALM=SAMBA.EXAMPLE.COM DNSNAME="samba.example.com" BASEDN="dc=samba,dc=example,dc=com" PASSWORD=penguin SRCDIR=`pwd` ROOT=$USER SERVER=localhost NETBIOSNAME=localtest if test -z "$ROOT"; then ROOT=$LOGNAME fi if test -z "$ROOT"; then ROOT=`whoami` fi oldpwd=`pwd` srcdir=`dirname $0`/../.. mkdir -p $PREFIX || exit $? cd $PREFIX PREFIX_ABS=`pwd` cd $oldpwd TMPDIR=$PREFIX_ABS/tmp ETCDIR=$PREFIX_ABS/etc PIDDIR=$PREFIX_ABS/pid CONFFILE=$ETCDIR/smb.conf KRB5_CONFIG=$ETCDIR/krb5.conf PRIVATEDIR=$PREFIX_ABS/private NCALRPCDIR=$PREFIX_ABS/ncalrpc LOCKDIR=$PREFIX_ABS/lockdir WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbind_socket CONFIGURATION="--configfile=$CONFFILE" LDAPDIR=$PREFIX_ABS/ldap rm -rf $PREFIX/* mkdir -p $PRIVATEDIR $ETCDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $LDAPDIR/db $LDAPDIR/db/bdb-logs $LDAPDIR/db/tmp cat >$CONFFILE<$PRIVATEDIR/share.ldif</dev/null || exit 1 . `dirname $0`/mk-keyblobs.sh cat >$KRB5_CONFIG</dev/null 2>&1 || { echo "">&2 echo "Failed to create configuration!" >&2 $srcdir/bin/testparm $CONFIGURATION >&2 exit 1 } ( $srcdir/bin/testparm $CONFIGURATION -v --suppress-prompt --parameter-name="netbios name" --section-name=global 2> /dev/null | grep -i ^$NETBIOSNAME ) >/dev/null 2>&1 || { echo "$?" >&2 $srcdir/bin/testparm $CONFIGURATION -v --suppress-prompt --parameter-name="netbios name" --section-name=global --suppress-prompt 2> /dev/null | grep -i ^$NETBIOSNAME >&2 echo "Failed to create configuration!" >&2 exit 1 } PROVISION_OPTIONS="$CONFIGURATION --host-name=$NETBIOSNAME --host-ip=127.0.0.1" PROVISION_OPTIONS="$PROVISION_OPTIONS --quiet --domain $DOMAIN --realm $REALM" PROVISION_OPTIONS="$PROVISION_OPTIONS --adminpass $PASSWORD --root=$ROOT" PROVISION_OPTIONS="$PROVISION_OPTIONS --simple-bind-dn=cn=Manager,$BASEDN --password=$PASSWORD --root=$ROOT" $srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS >&2 LDAP_URI="ldapi://"`echo $LDAPDIR/ldapi | sed 's|/|%2F|g'` . `dirname $0`/mk-openldap.sh test -z "$FEDORA_DS_PREFIX" || { . `dirname $0`/mk-fedora-ds.sh } cat >$PRIVATEDIR/wins_config.ldif</dev/null || exit 1 echo "KRB5_CONFIG=$KRB5_CONFIG" echo "PREFIX_ABS=$PREFIX_ABS" echo "SLAPD_CONF=$SLAPD_CONF" echo "PIDDIR=$PIDDIR" echo "SERVER=$SERVER" echo "NETBIOSNAME=$NETBIOSNAME" echo "LDAP_URI=$LDAP_URI" echo "DOMAIN=$DOMAIN" echo "USERNAME=$USERNAME" echo "REALM=$REALM" echo "DNSNAME=$DNSNAME" echo "BASEDN=$BASEDN" echo "PASSWORD=$PASSWORD" echo "SRCDIR=$SRCDIR" echo "PREFIX=$PREFIX" echo "LDAPDIR=$LDAPDIR" echo "CONFFILE=$CONFFILE" echo "PROVISION_OPTIONS=$PROVISION_OPTIONS" echo "PROVISION_ACI=$PROVISION_ACI" echo "WINBINDD_SOCKET_DIR=$WINBINDD_SOCKET_DIR" echo "NCALRPCDIR=$NCALRPCDIR" echo "CONFIGURATION=$CONFIGURATION"