#!/bin/bash
#----------------------------------------------------------------------------
# /var/install/bin/samba-show-variables - show all smb.conf variables
#
# Copyright (c) 2002-2013 Thomas Bork, tom(at)eisfair(dot)net
#
# Creation   : 2003-11-21 tb
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------
. /var/install/include/eislib

docfile=`/bin/mktemp -t samba-show-variables-XXXXXXXXXX`
if [ $? -ne 0 ]
then
    docfile="/tmp/samba-show-variables-$$"
fi

smbconffile='/etc/smb.conf'

if [ ! -f "$smbconffile" ]
then
    mecho --error "No configuration file $smbconffile found!"
    exit 1
fi

cat /etc/user.map >"$docfile"
{
 echo
 echo
 echo "#----------------------------------------------------------------------------"
 echo "# This is your current active configuration."
 echo "#"
 echo "# You can see here an otput of *all* options, that were used, not used"
 echo "# and are thus set to their defaults."
 echo "#"
 echo "# This is much more than your smb.conf will show you!"
 echo "#----------------------------------------------------------------------------"
 echo
} >>"$docfile"

/usr/bin/testparm -sv >>"$docfile" 2>&1

/var/install/bin/doc "$docfile"
rm -f "$docfile"
