mirror of
https://github.com/samba-team/samba.git
synced 2025-03-23 06:50:21 +03:00
tests/eventscripts: Rewrite the testparm stub
It currently needs the real testparm command installed even though it only uses limited features. It is easy enough to fake up the functionality that 50.samba uses. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7ef9916bd95ff2472359a412eac5489f1aad2dce)
This commit is contained in:
parent
cb8517ed4c
commit
d26c21df4a
@ -1,25 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ensure that testparm always uses our canned configuration instead of
|
||||
# the global one, unless some other file is specified. This requires
|
||||
# testparm to be installed but is quicker than reimplementing all the
|
||||
# various command-line options.
|
||||
not_implemented ()
|
||||
{
|
||||
echo "testparm: option \"$1\" not implemented in stub" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
file_specified=false
|
||||
# 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_specified=true
|
||||
*) file="$i" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if $file_specified ; then
|
||||
# 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.
|
||||
/usr/bin/testparm "$@"
|
||||
cat "$file"
|
||||
else
|
||||
# We force our own smb.conf and add the shares.
|
||||
/usr/bin/testparm "$@" "${CTDB_ETCDIR}/samba/smb.conf"
|
||||
cat "${CTDB_ETCDIR}/samba/smb.conf"
|
||||
|
||||
for i in $FAKE_SHARES ; do
|
||||
bi=$(basename "$i")
|
||||
|
Loading…
x
Reference in New Issue
Block a user