resolve bug #3501855 - correct values for confdir and logdir parameters not written...
[OSXPackageBuilder.git] / constructPkgContent.sh
1 #!/bin/sh
2
3 # File        :  constructPkgContent.sh
4 #
5 # Purpose     :  Create the hierarchy of folders and files that will 
6 #                comprise the installation package.
7 #
8 # Copyright   :  Written by and Copyright (C) 2001-2012 the
9 #                Privoxy team. http://www.privoxy.org/
10 #
11 #                This program is free software; you can redistribute it
12 #                and/or modify it under the terms of the GNU General
13 #                Public License as published by the Free Software
14 #                Foundation; either version 2 of the License, or (at
15 #                your option) any later version.
16 #
17 #                This program is distributed in the hope that it will
18 #                be useful, but WITHOUT ANY WARRANTY; without even the
19 #                implied warranty of MERCHANTABILITY or FITNESS FOR A
20 #                PARTICULAR PURPOSE.  See the GNU General Public
21 #                License for more details.
22 #
23 #                The GNU General Public License should be included with
24 #                this file.  If not, you can view it at
25 #                http://www.gnu.org/copyleft/gpl.html
26 #                or write to the Free Software Foundation, Inc.,
27 #                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 #                USA
29 #
30 # Modification : If you modify this file please consider whether your 
31 #                changes ought to be passed back to the macsetup module.
32 #
33
34 # Remove existing 'pkg content' folder if found
35 echo ""
36 echo "Remove existing 'pkg content' folder if found"
37 rm -rf pkg\ content
38
39 # Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'
40 echo ""
41 echo "Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'"
42 echo ""
43 cp -vR pkg\ content\ skeleton pkg\ content
44
45 # Copy the compiled privoxy binary from the 'current' project
46 echo ""
47 echo ""
48 echo "Copy the compiled privoxy binary from the 'current' project"
49 echo ""
50 cp -v ../current/privoxy pkg\ content/usr/local/sbin
51
52 # Copy the configuration hierarchy from the 'current' project
53 echo ""
54 echo ""
55 echo "Copy most of the configuration hierarchy from the 'current' project"
56 echo ""
57 for i in default.action default.filter match-all.action trust user.action user.filter templates; do
58         if [ "$i" = "templates" ]; then
59                 # for the templates subfolder copy all files therein
60                 cp -vR ../current/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
61         else
62                 # for all regular files just copy them across
63                 cp -v ../current/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
64         fi
65 done
66
67 # Enter the correct values for confdir and logdir into the config file 
68 echo ""
69 echo ""
70 echo "Copy the config file from the 'current' project, modifying the confdir and logdir in passing"
71 echo ""
72 sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../current/config > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp
73 sed 's/logdir ./logdir \/var\/log\/privoxy/g' pkg\ content/usr/local/etc/privoxy/vanilla/config_temp > pkg\ content/usr/local/etc/privoxy/vanilla/config
74 rm -f pkg\ content/usr/local/etc/privoxy/vanilla/config_temp
75
76 # Copy the documentation hierarchy from the 'current' project
77 echo ""
78 echo ""
79 echo "Copy the documentation hierarchy from the 'current' project"
80 echo ""
81 # copy the required directory hierarchies
82 for i in developer-manual faq images man-page team user-manual; do
83         cp -vR ../current/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
84 done
85 # copy the top-level files
86 for i in announce.txt p_doc.css privoxy-index.html; do
87         cp -v ../current/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
88 done
89 # copy the project's AUTHORS, ChangeLog, LICENSE and README files
90 for i in AUTHORS ChangeLog LICENSE README; do
91         cp -v ../current/$i pkg\ content/usr/local/share/doc/privoxy/$i
92 done
93
94 # Copy the manpage from the 'current' project
95 echo ""
96 echo ""
97 echo "Copy the manpage from the 'current' project"
98 echo ""
99 cp -v ../current/privoxy.1 pkg\ content/usr/local/share/man/man1
100
101 # Remove CVS administration files
102 echo ""
103 echo ""
104 echo "Remove CVS administration files"
105 echo ""
106 find pkg\ content -name CVS.sandboxinfo -exec rm -rf {} \;
107 find pkg\ content -name CVS -exec rm -rf {} \;
108