2004-10-31 05:32:35 +03:00
#!/bin/sh
#
# Copyright (C) Shirish A Kalele 2000
# Copyright (C) Gerald Carter 2004
#
# script for build solaris Samba package
#
2004-10-31 06:11:41 +03:00
INSTALL_BASE = /opt/samba
2004-11-09 20:47:57 +03:00
SBINPROGS = "smbd nmbd winbindd swat"
2005-10-14 22:54:12 +04:00
BINPROGS = "findsmb nmblookup eventlogadm pdbedit rpcclient smbclient smbcquotas smbspool smbtar tdbbackup testparm wbinfo net ntlm_auth profiles smbcacls smbcontrol smbpasswd smbstatus smbtree tdbdump"
2004-10-31 05:32:35 +03:00
MSGFILES = "de.msg en.msg fr.msg it.msg ja.msg nl.msg pl.msg tr.msg"
VFSLIBS = "audit.so default_quota.so extd_audit.so full_audit.so readonly.so shadow_copy.so cap.so expand_msdfs.so fake_perms.so netatalk.so recycle.so"
DATFILES = "lowcase.dat upcase.dat valid.dat"
CHARSETLIBS = "CP437.so CP850.so"
2005-12-03 04:03:16 +03:00
AUTHLIBS = "script.so"
2004-10-31 05:32:35 +03:00
add_dynamic_entries( )
{
# Add the binaries, docs and SWAT files
cd $TMPINSTALLDIR /$INSTALL_BASE
echo "#\n# Server Binaries \n#"
for file in $SBINPROGS ; do
echo f none sbin/$file 0755 root other
done
echo "#\n# User Binaries \n#"
for file in $BINPROGS ; do
echo f none bin/$file 0755 root other
done
echo "#\n# Libraries\n#"
for file in $MSGFILES ; do
echo f none lib/$file 0644 root other
done
for file in $DATFILES ; do
echo f none lib/$file 0644 root other
done
2004-11-09 20:47:57 +03:00
for file in $VFSLIBS ; do
echo f none lib/vfs/$file 0755 root other
done
2004-10-31 05:32:35 +03:00
for file in $CHARSETLIBS ; do
echo f none lib/charset/$file 0755 root other
done
2005-10-18 23:32:19 +04:00
for file in $AUTHLIBS ; do
echo f none lib/auth/$file 0755 root other
done
2004-10-31 05:32:35 +03:00
echo "#\n# libsmbclient\n#"
echo f none lib/libsmbclient.so 0755 root other
2005-10-17 20:58:53 +04:00
echo f none lib/libsmbclient.a 0755 root other
2004-10-31 05:32:35 +03:00
echo f none include/libsmbclient.h 0644 root other
2005-10-17 20:58:53 +04:00
echo "#\n# libmsrpc\n#"
echo f none lib/libmsrpc.so 0755 root other
echo f none lib/libmsrpc.a 0755 root other
echo f none include/libmsrpc.h 0644 root other
2004-12-02 00:01:27 +03:00
if [ -f lib/smbwrapper.so -a -f bin/smbsh ] ; then
echo "#\n# smbwrapper\n#"
echo f none lib/smbwrapper.so 0755 root other
echo f none bin/smbsh 0755 root other
fi
2004-11-01 05:00:09 +03:00
2005-05-14 05:21:18 +04:00
echo "#\n# nss_winbind.so and nss_wins.so\n#"
2004-11-09 20:47:57 +03:00
echo f none /lib/nss_winbind.so.1= lib/nss_winbind.so.1 0755 root other
2005-05-14 05:21:18 +04:00
echo f none /lib/nss_wins.so.1= lib/nss_wins.so.1 0755 root other
2004-11-09 20:47:57 +03:00
# echo s none /lib/nss_winbind.so.1=/usr/lib/nss_winbind.so.1 0755 root other
2005-05-14 05:21:18 +04:00
# echo s none /lib/nss_wins.so.1=/usr/lib/nss_wins.so.1 0755 root other
2004-10-31 05:32:35 +03:00
if [ -f lib/pam_winbind.so ] ; then
echo f none /usr/lib/security/pam_winbind.so= lib/pam_winbind.so 0755 root other
fi
echo "#\n# man pages \n#"
# Create directories for man page sections if nonexistent
cd man
for i in 1 2 3 4 5 6 7 8 9; do
2004-11-09 20:47:57 +03:00
manpages = ` ls man$i 2>/dev/null`
2004-10-31 05:32:35 +03:00
if [ $? -eq 0 ] ; then
2004-11-09 20:47:57 +03:00
echo d none man/man${ i } ? ? ?
2004-10-31 05:32:35 +03:00
for manpage in $manpages ; do
2004-11-09 20:47:57 +03:00
echo f none man/man${ i } /${ manpage } 0644 root other
2004-10-31 05:32:35 +03:00
done
fi
done
cd ..
echo "#\n# SWAT \n#"
list = ` find swat -type d | grep -v " /.svn $" `
for dir in $list ; do
if [ -d $dir ] ; then
echo d none $dir 0755 root other
fi
done
list = ` find swat -type f | grep -v /.svn/`
for file in $list ; do
if [ -f $file ] ; then
echo f none $file 0644 root other
fi
done
# Create entries for docs for the beginner
2004-11-09 20:47:57 +03:00
echo 's none docs/using_samba=$BASEDIR/swat/using_samba'
2004-10-31 05:32:35 +03:00
for file in docs/*pdf; do
echo f none $file 0644 root other
done
}
#####################################################################
## BEGIN MAIN
#####################################################################
# Try to guess the distribution base..
2004-12-02 00:01:27 +03:00
DISTR_BASE = ` dirname \` pwd\` | sed -e 's@/packaging$@@' `
echo " Distribution base: $DISTR_BASE "
TMPINSTALLDIR = " /tmp/`basename $DISTR_BASE `-build "
echo " Temp install dir: $TMPINSTALLDIR "
echo " Install directory: $INSTALL_BASE "
2004-10-31 05:32:35 +03:00
##
## first build the source
##
cd $DISTR_BASE /source
if [ " x $1 " != "xnobuild" ] ; then
2004-12-02 00:01:27 +03:00
./configure --prefix= $INSTALL_BASE \
2004-10-31 05:32:35 +03:00
--with-acl-support \
--with-included-popt \
--localstatedir= /var/lib/samba \
--with-piddir= /var/run \
--with-logfilebase= /var/log/samba \
--with-privatedir= /etc/samba/private \
--with-configdir= /etc/samba \
&& make
if [ $? -ne 0 ] ; then
echo "Build failed! Exiting...."
exit 1
fi
fi
2004-12-02 00:01:27 +03:00
mkdir $TMPINSTALLDIR
2004-10-31 05:32:35 +03:00
make DESTDIR = $TMPINSTALLDIR install
## clear out *.old
2004-12-02 00:01:27 +03:00
find $TMPINSTALLDIR -name \* .old | while read x; do rm -rf " $x " ; done
2004-10-31 05:32:35 +03:00
##
## Now get the install locations
##
SBINDIR = ` bin/smbd -b | grep SBINDIR | awk '{print $2}' `
BINDIR = ` bin/smbd -b | grep BINDIR | grep -v SBINDIR | awk '{print $2}' `
SWATDIR = ` bin/smbd -b | grep SWATDIR | awk '{print $2}' `
CONFIGFILE = ` bin/smbd -b | grep CONFIGFILE | awk '{print $2}' `
2005-05-14 05:21:18 +04:00
LOCKDIR = ` bin/smbd -b | grep LOCKDIR | awk '{print $2}' `
2004-10-31 05:32:35 +03:00
CONFIGDIR = ` dirname $CONFIGFILE `
LOGFILEBASE = ` bin/smbd -b | grep LOGFILEBASE | awk '{print $2}' `
LIBDIR = ` bin/smbd -b | grep LIBDIR | awk '{print $2}' `
PIDDIR = ` bin/smbd -b | grep PIDDIR | awk '{print $2}' `
PRIVATE_DIR = ` bin/smbd -b | grep PRIVATE_DIR | awk '{print $2}' `
DOCDIR = $INSTALL_BASE /docs
##
2005-05-14 05:21:18 +04:00
## copy some misc files that are not done as part of 'make install'
2004-10-31 05:32:35 +03:00
##
2005-05-14 05:21:18 +04:00
cp -fp nsswitch/libnss_wins.so $TMPINSTALLDIR /$LIBDIR /nss_wins.so.1
2004-11-09 20:47:57 +03:00
cp -fp nsswitch/libnss_winbind.so $TMPINSTALLDIR /$LIBDIR /nss_winbind.so.1
2004-10-31 05:32:35 +03:00
if [ -f nsswitch/pam_winbind.so ] ; then
cp -fp nsswitch/pam_winbind.so $TMPINSTALLDIR /$LIBDIR /pam_winbind.so
fi
2004-12-02 00:01:27 +03:00
if [ -f bin/smbwrapper.so ] ; then
cp -fp bin/smbwrapper.so $TMPINSTALLDIR /$INSTALL_BASE /lib
fi
if [ -f bin/smbsh ] ; then
cp -fp bin/smbsh $TMPINSTALLDIR /$INSTALL_BASE /bin
fi
2004-11-01 05:00:09 +03:00
2004-10-31 05:32:35 +03:00
mkdir -p $TMPINSTALLDIR /$INSTALL_BASE /docs
cp -p ../docs/*pdf $TMPINSTALLDIR /$INSTALL_BASE /docs
cd $DISTR_BASE /packaging/Solaris
##
## Main driver
##
# Setup version from smbd -V
VERSION = ` $TMPINSTALLDIR /$SBINDIR /smbd -V | awk '{print $2}' `
sed -e " s|__VERSION__| $VERSION | " -e "s|__ARCH__|`uname -p`|" -e " s|__BASEDIR__| $INSTALL_BASE |g " pkginfo.master > pkginfo
sed -e " s|__BASEDIR__| $INSTALL_BASE |g " inetd.conf.master > inetd.conf
sed -e " s|__BASEDIR__| $INSTALL_BASE |g " samba.init.master > samba.init
##
## copy over some scripts need for packagaing
##
mkdir -p $TMPINSTALLDIR /$INSTALL_BASE /scripts
for i in inetd.conf samba.init smb.conf.default services; do
cp -fp $i $TMPINSTALLDIR /$INSTALL_BASE /scripts
done
##
## Start building the prototype file
##
2004-10-31 06:11:41 +03:00
echo " CONFIGDIR= $CONFIGDIR " >> pkginfo
echo " LOGFILEBASE= $LOGFILEBASE " >> pkginfo
2005-05-14 05:21:18 +04:00
echo " LOCKDIR= $LOCKDIR " >> pkginfo
2004-10-31 06:11:41 +03:00
echo " PIDDIR= $PIDDIR " >> pkginfo
echo " PRIVATE_DIR= $PRIVATE_DIR " >> pkginfo
cp prototype.master prototype
2004-10-31 05:32:35 +03:00
# Add the dynamic part to the prototype file
( add_dynamic_entries >> prototype)
##
## copy packaging files
##
for i in prototype pkginfo copyright preremove postinstall request i.swat r.swat; do
cp $i $TMPINSTALLDIR /$INSTALL_BASE
done
# Create the package
pkgmk -o -d /tmp -b $TMPINSTALLDIR /$INSTALL_BASE -f prototype
if [ $? = 0 ] ; then
pkgtrans /tmp samba.pkg samba
fi
echo The samba package is in /tmp