3 # Copyright (C) Shirish A Kalele 2000
4 # Copyright (C) Gerald Carter 2004
6 # script for build solaris Samba package
9 INSTALL_BASE
=/opt
/samba
11 SBINPROGS
="smbd nmbd winbindd"
12 BINPROGS
="findsmb nmblookup eventlogadm pdbedit rpcclient smbclient smbcquotas smbspool smbtar tdbbackup testparm wbinfo net ntlm_auth profiles smbcacls smbcontrol smbpasswd smbstatus smbtree tdbdump"
13 MSGFILES
="de.msg en.msg fi.msg fr.msg it.msg ja.msg nl.msg pl.msg tr.msg"
14 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"
15 CHARSETLIBS
="CP437.so CP850.so"
20 # Add the binaries and docs
21 cd $TMPINSTALLDIR/$INSTALL_BASE
23 echo "#\n# Server Binaries \n#"
24 for file in $SBINPROGS; do
25 echo f none sbin
/$file 0755 root other
28 echo "#\n# User Binaries \n#"
29 for file in $BINPROGS; do
30 echo f none bin
/$file 0755 root other
33 echo "#\n# Libraries\n#"
34 for file in $MSGFILES; do
35 echo f none lib
/$file 0644 root other
37 for file in $VFSLIBS; do
38 echo f none lib
/vfs
/$file 0755 root other
40 for file in $CHARSETLIBS; do
41 echo f none lib
/charset
/$file 0755 root other
43 for file in $AUTHLIBS; do
44 echo f none lib
/auth
/$file 0755 root other
47 echo "#\n# libsmbclient\n#"
48 echo f none lib
/libsmbclient.so
0755 root other
49 echo f none include
/libsmbclient.h
0644 root other
51 echo "#\n# libmsrpc\n#"
53 if [ -f lib
/smbwrapper.so
-a -f bin
/smbsh
]; then
54 echo "#\n# smbwrapper\n#"
55 echo f none lib
/smbwrapper.so
0755 root other
56 echo f none bin
/smbsh
0755 root other
59 echo "#\n# nss_winbind.so and nss_wins.so\n#"
60 echo f none
/lib
/nss_winbind.so
.1=lib
/nss_winbind.so
.1 0755 root other
61 echo f none
/lib
/nss_wins.so
.1=lib
/nss_wins.so
.1 0755 root other
62 # echo s none /lib/nss_winbind.so.1=/usr/lib/nss_winbind.so.1 0755 root other
63 # echo s none /lib/nss_wins.so.1=/usr/lib/nss_wins.so.1 0755 root other
64 if [ -f lib
/pam_winbind.so
]; then
65 echo f none
/usr
/lib
/security
/pam_winbind.so
=lib
/pam_winbind.so
0755 root other
68 echo "#\n# man pages \n#"
70 # Create directories for man page sections if nonexistent
72 for i
in 1 2 3 4 5 6 7 8 9; do
74 manpages
=`ls man$i 2>/dev/null`
77 echo d none
share
/man
/man
${i} ? ? ?
78 for manpage
in $manpages; do
79 echo f none
share
/man
/man
${i}/${manpage} 0644 root other
85 #####################################################################
87 #####################################################################
89 # Try to guess the distribution base..
90 DISTR_BASE
=`dirname \`pwd\
` |sed -e 's@/packaging$@@'`
91 echo "Distribution base: $DISTR_BASE"
93 TMPINSTALLDIR
="/tmp/`basename $DISTR_BASE`-build"
94 echo "Temp install dir: $TMPINSTALLDIR"
95 echo "Install directory: $INSTALL_BASE"
98 ## first build the source
101 cd $DISTR_BASE/source
103 if test "x$1" = "xbuild" -o ! -f bin
/smbd
]; then
104 .
/configure
--prefix=$INSTALL_BASE \
105 --localstatedir=/var
/lib
/samba \
106 --with-piddir=/var
/run \
107 --with-logfilebase=/var
/log
/samba \
108 --with-privatedir=/etc
/samba
/private \
109 --with-configdir=/etc
/samba \
110 --with-lockdir=/var
/lib
/samba \
111 --with-mandir=/usr
/share
/man \
112 --with-pam --with-acl-support \
113 --with-quotas --with-included-popt \
116 if [ $?
-ne 0 ]; then
117 echo "Build failed! Exiting...."
122 rm -rf $TMPINSTALLDIR
123 mkdir
-p $TMPINSTALLDIR
124 make DESTDIR
=$TMPINSTALLDIR install
127 find $TMPINSTALLDIR -name \
*.old |
while read x
; do rm -rf "$x"; done
130 ## Now get the install locations
132 LD_LIBRARY_PATH
=$DISTR_BASE/source
/bin
133 export LD_LIBRARY_PATH
134 SBINDIR
=`bin/smbd -b | grep SBINDIR | awk '{print $2}'`
135 BINDIR
=`bin/smbd -b | grep BINDIR | grep -v SBINDIR | awk '{print $2}'`
136 CONFIGFILE
=`bin/smbd -b | grep CONFIGFILE | awk '{print $2}'`
137 LOCKDIR
=`bin/smbd -b | grep LOCKDIR | awk '{print $2}'`
138 CONFIGDIR
=`dirname $CONFIGFILE`
139 LOGFILEBASE
=`bin/smbd -b | grep LOGFILEBASE | awk '{print $2}'`
140 LIBDIR
=`bin/smbd -b | grep LIBDIR | awk '{print $2}'`
141 PIDDIR
=`bin/smbd -b | grep PIDDIR | awk '{print $2}'`
142 PRIVATE_DIR
=`bin/smbd -b | grep PRIVATE_DIR | awk '{print $2}'`
143 DOCDIR
=$INSTALL_BASE/docs
146 ## copy some misc files that are not done as part of 'make install'
148 cp -fp nsswitch
/libnss_wins.so
$TMPINSTALLDIR/$LIBDIR/nss_wins.so
.1
149 cp -fp nsswitch
/libnss_winbind.so
$TMPINSTALLDIR/$LIBDIR/nss_winbind.so
.1
150 if [ -f bin
/pam_winbind.so
]; then
151 cp -fp bin
/pam_winbind.so
$TMPINSTALLDIR/$LIBDIR/pam_winbind.so
153 if [ -f bin
/smbwrapper.so
]; then
154 cp -fp bin
/smbwrapper.so
$TMPINSTALLDIR/$INSTALL_BASE/lib
156 if [ -f bin
/smbsh
]; then
157 cp -fp bin
/smbsh
$TMPINSTALLDIR/$INSTALL_BASE/bin
160 mkdir
-p $TMPINSTALLDIR/$INSTALL_BASE/docs
161 cp -p ..
/docs
/*pdf
$TMPINSTALLDIR/$INSTALL_BASE/docs
164 cd $DISTR_BASE/packaging
/Solaris
170 # Setup version from smbd -V
172 VERSION
=`$TMPINSTALLDIR/$SBINDIR/smbd -V | awk '{print $2}'`
173 sed -e "s|__VERSION__|$VERSION|" -e "s|__ARCH__|`uname -p`|" -e "s|__BASEDIR__|$INSTALL_BASE|g" pkginfo.master
> pkginfo
175 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" inetd.conf.master
> inetd.conf
176 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" samba.init.master
> samba.init
179 ## copy over some scripts need for packagaing
181 mkdir
-p $TMPINSTALLDIR/$INSTALL_BASE/scripts
182 for i
in samba.init smb.conf.default
; do
183 cp -fp $i $TMPINSTALLDIR/$INSTALL_BASE/scripts
187 ## Start building the prototype file
189 echo "CONFIGDIR=$CONFIGDIR" >> pkginfo
190 echo "LOGFILEBASE=$LOGFILEBASE" >> pkginfo
191 echo "LOCKDIR=$LOCKDIR" >> pkginfo
192 echo "PIDDIR=$PIDDIR" >> pkginfo
193 echo "PRIVATE_DIR=$PRIVATE_DIR" >> pkginfo
195 cp prototype.master prototype
197 # Add the dynamic part to the prototype file
198 (add_dynamic_entries
>> prototype
)
201 ## copy packaging files
203 for i
in prototype pkginfo copyright preremove postinstall request
; do
204 cp $i $TMPINSTALLDIR/$INSTALL_BASE
208 pkgmk
-o -d /tmp
-b $TMPINSTALLDIR/$INSTALL_BASE -f prototype
211 pkgtrans
/tmp samba.pkg samba
214 echo The samba package is
in /tmp