Remove references to obsolete codepage binaries, codepages and unicode
[ira/wip.git] / packaging / Solaris / makepkg.sh
1 #!/bin/sh
2 #
3 # Copyright (C) Shirish A Kalele 2000
4 #
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
9 #
10 INSTALL_BASE=/usr/local
11
12 add_dynamic_entries() 
13 {
14   # Add the binaries, docs and SWAT files
15
16   echo "#\n# Binaries \n#"
17   cd $DISTR_BASE/source/bin
18   for binfile in *
19   do
20     if [ -f $binfile ]; then
21       echo f none samba/bin/$binfile=source/bin/$binfile 0755 root other
22     fi
23   done
24
25   # Add the scripts to bin/
26   echo "#\n# Scripts \n#"
27   cd $DISTR_BASE/source/script
28   for shfile in *
29   do
30     if [ -f $shfile ]; then
31         echo f none samba/bin/$shfile=source/script/$shfile 0755 root other
32     fi
33   done
34
35   # Add the manpages
36   echo "#\n# man pages \n#"
37   echo d none /usr ? ? ?
38   echo d none /usr/share ? ? ?
39   echo d none /usr/share/man ? ? ?
40
41   # Create directories for man page sections if nonexistent
42   cd $DISTR_BASE/docs/manpages
43   for i in 1 2 3 4 5 6 7 8 9
44   do
45      manpages=`ls *.$i 2>/dev/null`
46      if [ $? -eq 0 ]
47      then
48         echo d none /usr/share/man/man$i ? ? ?
49         for manpage in $manpages 
50         do
51                 echo f none /usr/share/man/man${i}/${manpage}=docs/manpages/$manpage 0644 root other
52         done
53      fi
54   done
55
56   echo "#\n# HTML documentation \n#"
57   cd $DISTR_BASE
58   list=`find docs/htmldocs -type d | grep -v "/CVS$"`
59   for docdir in $list
60   do
61     if [ -d $docdir ]; then
62         echo d none samba/$docdir 0755 root other
63     fi
64   done
65
66   list=`find docs/htmldocs -type f | grep -v /CVS/`
67   for htmldoc in $list
68   do
69     if [ -f $htmldoc ]; then
70       echo f none samba/$htmldoc=$htmldoc 0644 root other
71     fi
72   done
73
74   # Create a symbolic link to the Samba book in docs/ for beginners
75   echo 's none samba/docs/samba_book=htmldocs/using_samba'
76
77   echo "#\n# Text Docs \n#"
78   echo d none samba/docs/textdocs 0755 root other
79   cd $DISTR_BASE/docs/textdocs
80   for textdoc in *
81   do 
82     if [ -f $textdoc ]; then
83       echo f none samba/docs/textdocs/$textdoc=docs/textdocs/$textdoc 0644 root other
84     fi
85   done
86   echo "#\n# SWAT \n#"
87   cd $DISTR_BASE
88   list=`find swat -type d | grep -v "/CVS$"`
89   for i in $list
90   do
91     echo "d none samba/$i 0755 root other"
92   done
93   list=`find swat -type f | grep -v /CVS/`
94   for i in $list
95   do
96     echo "f none samba/$i=$i 0644 root other"
97   done
98   echo "#\n# HTML documentation for SWAT\n#"
99   cd $DISTR_BASE/docs/htmldocs
100   for htmldoc in *
101   do
102     if [ -f $htmldoc ]; then
103       echo f none samba/swat/help/$htmldoc=docs/htmldocs/$htmldoc 0644 root other
104     fi
105   done
106
107   echo "#\n# Using Samba Book files for SWAT\n#"
108   cd $DISTR_BASE/docs/htmldocs
109
110 # set up a symbolic link instead of duplicating the book tree
111   echo 's none samba/swat/using_samba=../docs/htmldocs/using_samba'
112
113 }
114
115 if [ $# = 0 ]
116 then
117         # Try to guess the distribution base..
118         CURR_DIR=`pwd`
119         DISTR_BASE=`echo $CURR_DIR | sed 's|\(.*\)/packaging.*|\1|'`
120         echo "Assuming Samba distribution is rooted at $DISTR_BASE.."
121 else
122         DISTR_BASE=$1
123 fi
124
125 #
126 if [ ! -d $DISTR_BASE ]; then
127         echo "Source build directory $DISTR_BASE does not exist."
128         exit 1
129 fi
130
131 # Set up the prototype file from prototype.master
132 if [ -f prototype ]; then
133         rm prototype
134 fi
135
136 # Setup version from version.h
137 VERSION=`sed 's/#define VERSION \"\(.*\)\"$/\1/' ../../source/include/version.h`
138 sed -e "s|__VERSION__|$VERSION|" -e "s|__ARCH__|`uname -p`|" -e "s|__BASEDIR__|$INSTALL_BASE|g" pkginfo.master >pkginfo
139
140 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" inetd.conf.master >inetd.conf
141 sed -e "s|__BASEDIR__|$INSTALL_BASE|g" samba.server.master >samba.server
142
143 cp prototype.master prototype
144
145 # Add the dynamic part to the prototype file
146 (add_dynamic_entries >> prototype)
147
148 # Create the package
149 pkgmk -o -d /tmp -b $DISTR_BASE -f prototype
150 if [ $? = 0 ]
151 then
152         pkgtrans /tmp samba.pkg samba
153 fi
154 echo The samba package is in /tmp