#!/bin/sh
##
## Samba: Dump information from Samba binaries in source directory
## Copyright (c) 2007 SATOH Fumiyasu @ OSS Technology Co., Japan
##                    <http://www.osstech.co.jp/>
##
## Date: 2007-05-20, since 2007-05-20
## License: GNU General Public License version 2
##

set -u
set -e
LC_ALL=C
export LC_ALL

os_name="`uname`"
os_rel="`uname -r`"
os_arch="`uname -m`"

if [ x"$os_name" = x"Linux" ]; then
    os_name="`lsb_release -i |sed 's/^.*:[ 	]*//'`"
    os_rel="`lsb_release -r |sed 's/^.*:[ 	]*//;s/\..*$//'`"
    os_arch="`uname -i`"
elif [ x"$os_name" = x"SunOS" ]; then
    os_name="Solaris"
    os_rel="`uname -r |sed 's/^.*\.//'`"
    os_arch="`uname -p`"
fi

if [ $# -eq 0 ]; then
    echo "$os_name$os_rel-$os_arch"
    exit 0
fi

source_dir="$1"; shift
cd "$source_dir"

echo "Samba Binary Information"
echo "OS name: $os_name"
echo "OS release: $os_rel"
echo "OS architecture: $os_arch"

echo 
echo "smbd -b"
bin/smbd -b |sed -n '/^Paths:/,$p'

echo 
echo "ldd smbd"
ldd bin/smbd |sed 's/ (.*)$//' |sort

echo 
echo "ldd nmbd"
ldd bin/nmbd |sed 's/ (.*)$//' |sort

echo 
echo "ldd winbindd"
ldd bin/winbindd |sed 's/ (.*)$//' |sort

echo 
echo "ldd smbclient"
ldd bin/smbclient |sed 's/ (.*)$//' |sort

echo 
echo "ldd net"
ldd bin/net |sed 's/ (.*)$//' |sort

