3 # File : constructPkgContent.sh
5 # Purpose : Create the hierarchy of folders and files that will
6 # comprise the installation package.
8 # Copyright : Written by and Copyright (C) 2001-2012 the
9 # Privoxy team. http://www.privoxy.org/
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.
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.
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,
30 # Modification : If you modify this file please consider whether your
31 # changes ought to be passed back to the OSXPackageBuilder
35 # Use the common script to locate the directory containing Privoxy's source ($SOURCEDIR)
38 # Remove existing 'pkg content' folder if found
40 echo "Remove existing 'pkg content' folder if found"
43 # Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'
45 echo "Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'"
47 cp -vR pkg\ content\ skeleton pkg\ content
49 # Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory
52 echo "Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory"
54 mkdir -vp pkg\ content/usr/local/sbin
55 cp -v ../${SOURCE_DIR}/privoxy pkg\ content/usr/local/sbin
57 # Copy the configuration hierarchy from the '${SOURCE_DIR}' directory
60 echo "Copy most of the configuration hierarchy from the '${SOURCE_DIR}' directory"
62 mkdir -vp pkg\ content/usr/local/etc/privoxy/vanilla
63 for i in default.action default.filter match-all.action trust user.action user.filter templates; do
64 if [ "$i" = "templates" ]; then
65 # for the templates subfolder copy all files therein
66 cp -vR ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
68 # for all regular files just copy them across
69 cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
73 # Enter the correct values for confdir and logdir into the config file
76 echo "Copy the config file from the '${SOURCE_DIR}' directory, modifying the confdir, logdir and user-manual settings in passing"
78 sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../${SOURCE_DIR}/config > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp1
79 sed 's/logdir ./logdir \/var\/log\/privoxy/g' pkg\ content/usr/local/etc/privoxy/vanilla/config_temp1 > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp2
80 sed 's/#user-manual http:\/\/www.privoxy.org\/user-manual\//user-manual \/usr\/local\/share\/doc\/privoxy\/user-manual\//g' pkg\ content/usr/local/etc/privoxy/vanilla/config_temp2 > pkg\ content/usr/local/etc/privoxy/vanilla/config
81 rm -f pkg\ content/usr/local/etc/privoxy/vanilla/config_temp*
83 # Copy the documentation hierarchy from the '${SOURCE_DIR}' directory
86 echo "Copy the documentation hierarchy from the '${SOURCE_DIR}' directory"
88 mkdir -vp pkg\ content/usr/local/share/doc/privoxy
89 # copy the required directory hierarchies
90 for i in developer-manual faq images man-page team user-manual; do
91 cp -vR ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
93 # copy the top-level files
94 for i in announce.txt p_doc.css privoxy-index.html; do
95 cp -v ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
97 # copy p_doc.css down into user-manual subdir (as per the make install target)
98 cp -v ../${SOURCE_DIR}/doc/webserver/p_doc.css pkg\ content/usr/local/share/doc/privoxy/user-manual/p_doc.css
99 # copy the project's AUTHORS, ChangeLog, LICENSE and README files
100 for i in AUTHORS ChangeLog LICENSE README; do
101 cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/share/doc/privoxy/$i
104 # Copy the manpage from the '${SOURCE_DIR}' directory
107 echo "Copy the manpage from the '${SOURCE_DIR}' directory"
109 mkdir -vp pkg\ content/usr/local/share/man/man1
110 cp -v ../${SOURCE_DIR}/privoxy.8 pkg\ content/usr/local/share/man/man1
112 # Optionally copy the PCRE libraries
113 if [ "$1" == "-pcre" ]; then
116 echo "Copy the external PCRE libraries"
118 mkdir pkg\ content/usr/local/lib
119 cp -v /usr/local/lib/libpcre* pkg\ content/usr/local/lib
120 mkdir pkg\ content/usr/local/lib/pkgconfig
121 cp -v /usr/local/lib/pkgconfig/libpcre* pkg\ content/usr/local/lib/pkgconfig
124 # Remove CVS administration files
127 echo "Remove CVS administration files"
129 find pkg\ content -name CVS.sandboxinfo -exec rm -rf {} \;
130 find pkg\ content -name CVS -exec rm -rf {} \;