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 # First build the codepages and append codepage entries to prototype
15 echo "#\n# Codepages \n#"
16 echo d none samba/lib/codepages 0755 root other
18 CODEPAGELIST="437 737 850 852 861 932 866 949 950 936"
19 # Check if make_smbcodepage exists
20 if [ ! -f $DISTR_BASE/source/bin/make_smbcodepage ]; then
21 echo "Could not find $DISTR_BASE/source/bin/make_smbcodepage to generate codepages.\n\
22 Please create the binaries before packaging." >&2
26 for p in $CODEPAGELIST; do
27 $DISTR_BASE/source/bin/make_smbcodepage c $p $DISTR_BASE/source/codepages/codepage_def.$p $DISTR_BASE/source/codepages/codepage.$p
28 echo f none samba/lib/codepages/codepage.$p=source/codepages/codepage.$p 0644 root other
32 if [ ! -f $DISTR_BASE/source/bin/make_unicodemap ]; then
33 echo "Missing $DISTR_BASE/source/bin/make_unicodemap. Aborting." >&2
37 # Pull in all the unicode map files from source/codepages/CP*.TXT
38 list=`find $DISTR_BASE/source/codepages -name "CP*.TXT" | sed 's|^.*CP\(.*\)\.TXT|\1|'`
41 $DISTR_BASE/source/bin/make_unicodemap $umap $DISTR_BASE/source/codepages/CP$umap.TXT $DISTR_BASE/source/codepages/unicode_map.$umap
42 echo f none samba/lib/codepages/unicode_map.$umap=source/codepages/unicode_map.$umap 0644 root other
45 # Add the binaries, docs and SWAT files
47 echo "#\n# Binaries \n#"
48 cd $DISTR_BASE/source/bin
51 if [ -f $binfile ]; then
52 echo f none samba/bin/$binfile=source/bin/$binfile 0755 root other
55 echo "#\n# HTML documentation \n#"
57 list=`find docs/htmldocs -type d | grep -v "/CVS$"`
60 if [ -d $docdir ]; then
61 echo d none samba/$docdir 0755 root other
65 list=`find docs/htmldocs -type f | grep -v /CVS/`
68 if [ -f $htmldoc ]; then
69 echo f none samba/$htmldoc=$htmldoc 0644 root other
73 # Create a symbolic link to the Samba book in docs/ for beginners
74 echo 's none samba/docs/samba_book=htmldocs/using_samba'
76 echo "#\n# Text Docs \n#"
77 echo d none samba/docs/textdocs 0755 root other
78 cd $DISTR_BASE/docs/textdocs
81 if [ -f $textdoc ]; then
82 echo f none samba/docs/textdocs/$textdoc=docs/textdocs/$textdoc 0644 root other
87 list=`find swat -type d | grep -v "/CVS$"`
90 echo "d none samba/$i 0755 root other"
92 list=`find swat -type f | grep -v /CVS/`
95 echo "f none samba/$i=$i 0644 root other"
97 echo "#\n# HTML documentation for SWAT\n#"
98 cd $DISTR_BASE/docs/htmldocs
101 if [ -f $htmldoc ]; then
102 echo f none samba/swat/help/$htmldoc=docs/htmldocs/$htmldoc 0644 root other
106 echo "#\n# Using Samba Book files for SWAT\n#"
107 cd $DISTR_BASE/docs/htmldocs
109 # set up a symbolic link instead of duplicating the book tree
110 echo 's none samba/swat/using_samba=../docs/htmldocs/using_samba'
116 # Try to guess the distribution base..
118 DISTR_BASE=`echo $CURR_DIR | sed 's|\(.*\)/packaging.*|\1|'`
119 echo "Assuming Samba distribution is rooted at $DISTR_BASE.."
125 if [ ! -d $DISTR_BASE ]; then
126 echo "Source build directory $DISTR_BASE does not exist."
130 # Set up the prototype file from prototype.master
131 if [ -f prototype ]; then
135 # Setup version from version.h
136 VERSION=`sed 's/#define VERSION \"\(.*\)\"$/\1/' ../../source/include/version.h`
137 sed -e "s|__VERSION__|$VERSION|" -e "s|__ARCH__|`uname -p`|" -e "s|__BASEDIR__|$INSTALL_BASE|g" pkginfo.master >pkginfo
139 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" inetd.conf.master >inetd.conf
140 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" samba.server.master >samba.server
142 cp prototype.master prototype
144 # Add the dynamic part to the prototype file
145 (add_dynamic_entries >> prototype)
148 pkgmk -o -d /tmp -b $DISTR_BASE -f prototype
151 pkgtrans /tmp samba.pkg samba
153 echo The samba package is in /tmp