3 # Copyright (C) Shirish A Kalele 2000
5 # Builds a Samba package from the samba distribution.
6 # By default, the package will be built to install samba in /usr/local
7 # Change the INSTALL_BASE variable to change this: will modify the pkginfo
8 # and samba.server files to point to the new INSTALL_BASE
10 INSTALL_BASE=/usr/local
14 # Add the binaries, docs and SWAT files
16 echo "#\n# Binaries \n#"
17 cd $DISTR_BASE/source/bin
20 if [ -f $binfile ]; then
21 echo f none samba/bin/$binfile=source/bin/$binfile 0755 root other
25 # Add the scripts to bin/
26 echo "#\n# Scripts \n#"
27 cd $DISTR_BASE/source/script
30 if [ -f $shfile ]; then
31 echo f none samba/bin/$shfile=source/script/$shfile 0755 root other
35 # add libraries to /lib for winbind
36 echo "#\n# Libraries \n#"
37 if [ -f $DISTR_BASE/source/nsswitch/libnss_winbind.so ] ; then
38 echo f none /usr/lib/libnss_winbind.so=source/nsswitch/libnss_winbind.so 0755 root other
39 echo s none /usr/lib/libnss_winbind.so.1=/usr/lib/libnss_winbind.so 0755 root other
40 echo s none /usr/lib/libnss_winbind.so.2=/usr/lib/libnss_winbind.so 0755 root other
41 echo s none /usr/lib/nss_winbind.so.1=/usr/lib/libnss_winbind.so 0755 root other
42 echo s none /usr/lib/nss_winbind.so.2=/usr/lib/libnss_winbind.so 0755 root other
46 echo "#\n# man pages \n#"
47 echo d none /usr ? ? ?
48 echo d none /usr/share ? ? ?
49 echo d none /usr/share/man ? ? ?
51 # Create directories for man page sections if nonexistent
52 cd $DISTR_BASE/docs/manpages
53 for i in 1 2 3 4 5 6 7 8 9
55 manpages=`ls *.$i 2>/dev/null`
58 echo d none /usr/share/man/man$i ? ? ?
59 for manpage in $manpages
61 echo f none /usr/share/man/man${i}/${manpage}=docs/manpages/$manpage 0644 root other
66 echo "#\n# HTML documentation \n#"
68 list=`find docs/htmldocs -type d | grep -v "/CVS$"`
71 if [ -d $docdir ]; then
72 echo d none samba/$docdir 0755 root other
76 list=`find docs/htmldocs -type f | grep -v /CVS/`
79 if [ -f $htmldoc ]; then
80 echo f none samba/$htmldoc=$htmldoc 0644 root other
84 # Create a symbolic link to the Samba book in docs/ for beginners
85 echo 's none samba/docs/samba_book=htmldocs/using_samba'
87 echo "#\n# Text Docs \n#"
88 echo d none samba/docs/textdocs 0755 root other
89 cd $DISTR_BASE/docs/textdocs
92 if [ -f $textdoc ]; then
93 echo f none samba/docs/textdocs/$textdoc=docs/textdocs/$textdoc 0644 root other
98 list=`find swat -type d | grep -v "/CVS$"`
101 echo "d none samba/$i 0755 root other"
103 list=`find swat -type f | grep -v /CVS/`
106 echo "f none samba/$i=$i 0644 root other"
108 echo "#\n# HTML documentation for SWAT\n#"
109 cd $DISTR_BASE/docs/htmldocs
112 if [ -f $htmldoc ]; then
113 echo f none samba/swat/help/$htmldoc=docs/htmldocs/$htmldoc 0644 root other
117 echo "#\n# Using Samba Book files for SWAT\n#"
118 cd $DISTR_BASE/docs/htmldocs
120 # set up a symbolic link instead of duplicating the book tree
121 echo 's none samba/swat/using_samba=../docs/htmldocs/using_samba'
127 # Try to guess the distribution base..
129 DISTR_BASE=`echo $CURR_DIR | sed 's|\(.*\)/packaging.*|\1|'`
130 echo "Assuming Samba distribution is rooted at $DISTR_BASE.."
136 if [ ! -d $DISTR_BASE ]; then
137 echo "Source build directory $DISTR_BASE does not exist."
141 # Set up the prototype file from prototype.master
142 if [ -f prototype ]; then
146 # Setup version from version.h
147 VERSION=`sed 's/#define VERSION \"\(.*\)\"$/\1/' ../../source/include/version.h`
148 sed -e "s|__VERSION__|$VERSION|" -e "s|__ARCH__|`uname -p`|" -e "s|__BASEDIR__|$INSTALL_BASE|g" pkginfo.master >pkginfo
150 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" inetd.conf.master >inetd.conf
151 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" samba.server.master >samba.server
153 cp prototype.master prototype
155 # Add the dynamic part to the prototype file
156 (add_dynamic_entries >> prototype)
159 pkgmk -o -d /tmp -b $DISTR_BASE -f prototype
162 pkgtrans /tmp samba.pkg samba
164 echo The samba package is in /tmp