fix a few paths
[Samba.git] / packaging / Solaris / makepkg.sh
blobac85de8c3c03bde3cc34118dbc326077dba5e410
1 #!/bin/sh
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
12 add_dynamic_entries()
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
23 exit 1
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
29 done
31 # Create unicode maps
32 if [ ! -f $DISTR_BASE/source/bin/make_unicodemap ]; then
33 echo "Missing $DISTR_BASE/source/bin/make_unicodemap. Aborting." >&2
34 exit 1
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|'`
39 for umap in $list
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
43 done
45 # Add the binaries, docs and SWAT files
47 echo "#\n# libraries\n#"
48 echo f none /usr/lib/nss_winbind.so.1=source/nsswitch/libnss_winbind.so 0755 root other
49 echo f none /usr/lib/security/pam_winbind.so=source/nsswitch/pam_winbind.so 0755 root other
51 echo "#\n# libsmbclient\n#"
52 echo f none /usr/local/include/libsmbclient.h=source/include/libsmbclient.h 0755 root other
53 echo f none /usr/local/lib/libsmbclient.so=source/bin/libsmbclient.so 0755 root other
54 echo f none /usr/local/lib/libsmbclient.a=source/bin/libsmbclient.a 0755 root other
56 chmod 644 $DISTR_BASE/source/bin/libsmbclient.*
58 echo "#\n# Binaries \n#"
59 cd $DISTR_BASE/source/bin
60 for binfile in *
62 if [ -f $binfile -a -x $binfile ]; then
63 echo f none samba/bin/$binfile=source/bin/$binfile 0755 root other
65 done
67 chmod 755 $DISTR_BASE/source/bin/libsmbclient.*
69 # Add the scripts to bin/
70 echo "#\n# Scripts \n#"
71 echo f none samba/bin/findsmb=source/script/findsmb 755 root other
72 echo f none samba/bin/smbtar=source/script/smbtar 755 root other
73 echo f none samba/bin/smbadduser=source/script/smbadduser 755 root other
75 # Add the Registry files
76 echo "#\n# Registry files \n#"
77 echo d none samba/docs/Registry 0755 root other
78 cd $DISTR_BASE
79 list=`find docs/Registry -type f -name "*.reg" | grep -v "/CVS$"`
80 for regfile in $list
82 echo f none samba/$regfile=$regfile 0644 root other
83 done
85 # Add the manpages
86 echo "#\n# man pages \n#"
87 echo d none /usr ? ? ?
88 echo d none /usr/share ? ? ?
89 echo d none /usr/share/man ? ? ?
91 # Create directories for man page sections if nonexistent
92 cd $DISTR_BASE/docs/manpages
93 for i in 1 2 3 4 5 6 7 8 9
95 manpages=`ls *.$i 2>/dev/null`
96 if [ $? -eq 0 ]
97 then
98 echo d none /usr/share/man/man$i ? ? ?
99 for manpage in $manpages
101 echo f none /usr/share/man/man${i}/${manpage}=docs/manpages/$manpage 0644 root other
102 done
104 done
106 echo "#\n# HTML documentation \n#"
107 cd $DISTR_BASE
108 list=`find docs/htmldocs -type d | grep -v "/CVS$"`
109 for docdir in $list
111 if [ -d $docdir ]; then
112 echo d none samba/$docdir 0755 root other
114 done
116 list=`find docs/htmldocs -type f | grep -v /CVS/`
117 for htmldoc in $list
119 if [ -f $htmldoc ]; then
120 echo f none samba/$htmldoc=$htmldoc 0644 root other
122 done
124 # Create a symbolic link to the Samba book in docs/ for beginners
125 echo 's none samba/docs/samba_book=htmldocs/using_samba'
127 echo "#\n# Text Docs \n#"
128 echo d none samba/docs/textdocs 0755 root other
129 cd $DISTR_BASE/docs/textdocs
130 for textdoc in *
132 if [ -f $textdoc ]; then
133 echo f none samba/docs/textdocs/$textdoc=docs/textdocs/$textdoc 0644 root other
135 done
136 echo "#\n# SWAT \n#"
137 cd $DISTR_BASE
138 list=`find swat -type d | grep -v "/CVS$"`
139 for i in $list
141 echo "d none samba/$i 0755 root other"
142 done
143 list=`find swat -type f | grep -v /CVS/`
144 for i in $list
146 echo "f none samba/$i=$i 0644 root other"
147 done
148 echo "#\n# HTML documentation for SWAT\n#"
149 cd $DISTR_BASE/docs/htmldocs
150 for htmldoc in *
152 if [ -f $htmldoc ]; then
153 echo f none samba/swat/help/$htmldoc=docs/htmldocs/$htmldoc 0644 root other
155 done
157 echo "#\n# Using Samba Book files for SWAT\n#"
158 cd $DISTR_BASE/docs/htmldocs
160 # set up a symbolic link instead of duplicating the book tree
161 echo 's none samba/swat/using_samba=../docs/htmldocs/using_samba'
165 if [ $# = 0 ]
166 then
167 # Try to guess the distribution base..
168 CURR_DIR=`pwd`
169 DISTR_BASE=`echo $CURR_DIR | sed 's|\(.*\)/packaging.*|\1|'`
170 echo "Assuming Samba distribution is rooted at $DISTR_BASE.."
171 else
172 DISTR_BASE=$1
176 if [ ! -d $DISTR_BASE ]; then
177 echo "Source build directory $DISTR_BASE does not exist."
178 exit 1
181 # Set up the prototype file from prototype.master
182 if [ -f prototype ]; then
183 rm prototype
186 # Setup version from version.h
187 VERSION=`sed 's/#define VERSION \"\(.*\)\"$/\1/' ../../source/include/version.h`
188 sed -e "s|__VERSION__|$VERSION|" -e "s|__ARCH__|`uname -p`|" -e "s|__BASEDIR__|$INSTALL_BASE|g" pkginfo.master >pkginfo
190 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" inetd.conf.master >inetd.conf
191 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" samba.server.master >samba.server
193 cp prototype.master prototype
195 # Add the dynamic part to the prototype file
196 (add_dynamic_entries >> prototype)
198 # Create the package
199 pkgmk -o -d /tmp -b $DISTR_BASE -f prototype
200 if [ $? = 0 ]
201 then
202 pkgtrans /tmp samba-$VERSION.pkg samba
204 echo The samba package is in /tmp