1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/ctdb/tests/eventscripts/stubs/testparm
Martin Schwenke 121d1a8571 ctdb-scripts: Rename variable CTDB_ETCDIR to CTDB_SYS_ETCDIR
This variable points to /etc/ by default.

This distinguishes it from the different variable from wscript, which
points to /etc/ctdb/.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-09-15 08:56:21 +02:00

86 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
not_implemented ()
{
echo "testparm: option \"$1\" not implemented in stub" >&2
exit 2
}
error ()
{
cat >&2 <<EOF
Load smb config files from ${CTDB_SYS_ETCDIR}/samba/smb.conf
rlimit_max: increasing rlimit_max (2048) to minimum Windows limit (16384)
EOF
for i in $FAKE_SHARES ; do
bi=$(basename "$i")
echo "Processing section \"[${bi}]\""
done >&2
cat >&2 <<EOF
Loaded services file OK.
WARNING: 'workgroup' and 'netbios name' must differ.
EOF
exit 1
}
timeout ()
{
echo "$0: INTERNAL ERROR - timeout stub should avoid this" >&2
}
if [ -n "$FAKE_TESTPARM_FAIL" ] ; then
error
fi
if [ -n "$FAKE_TIMEOUT" ] ; then
timeout
fi
# Ensure that testparm always uses our canned configuration instead of
# the global one, unless some other file is specified.
file=""
parameter=""
for i ; do
case "$i" in
--parameter-name=*) parameter="${i#--parameter-name=}" ;;
-*) : ;;
*) file="$i" ;;
esac
done
# Just hard-code parameter requests for now. Later on they could be
# parsed out of the file.
case "$parameter" in
security) echo "ADS" ; exit 0 ;;
smb*ports) echo "445, 139" ; exit 0 ;;
?*) not_implemented "--parameter-name=$parameter" ;;
# Fall through if $parameter not set
esac
if [ -n "$file" ] ; then
# This should include the shares, since this is used when the
# samba eventscript caches the output.
cat "$file"
else
# We force our own smb.conf and add the shares.
cat "${CTDB_SYS_ETCDIR}/samba/smb.conf"
for i in $FAKE_SHARES ; do
bi=$(basename "$i")
cat <<EOF
[${bi}]
path = $i
comment = fake share $bi
guest ok = no
read only = no
browseable = yes
EOF
done
fi