Added text explaining how to start and stop Privoxy
[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 # Use the common script to locate the directory containing Privoxy's source ($SOURCEDIR)
35 . ./common.sh
36
37 # Remove existing 'pkg content' folder if found
38 echo ""
39 echo "Remove existing 'pkg content' folder if found"
40 rm -rf pkg\ content
41
42 # Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'
43 echo ""
44 echo "Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'"
45 echo ""
46 cp -vR pkg\ content\ skeleton pkg\ content
47
48 # Replace the version number placeholders in the uninstallation script
49 echo ""
50 echo "Replace the version number placeholders in the uninstallation script"
51 echo ""
52 VERSION=`perl findversion.pl ../${SOURCE_DIR}/ChangeLog`
53 sed "s/PRIVOXY_VERSION/${VERSION}/g" pkg\ content\ skeleton/Applications/Privoxy/uninstall.command > pkg\ content/Applications/Privoxy/uninstall.command
54
55 # Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory
56 echo ""
57 echo ""
58 echo "Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory"
59 echo ""
60 cp -v ../${SOURCE_DIR}/privoxy pkg\ content/usr/local/sbin
61
62 # Copy the configuration hierarchy from the '${SOURCE_DIR}' directory
63 echo ""
64 echo ""
65 echo "Copy most of the configuration hierarchy from the '${SOURCE_DIR}' directory"
66 echo ""
67 for i in default.action default.filter match-all.action trust user.action user.filter templates; do
68         if [ "$i" = "templates" ]; then
69                 # for the templates subfolder copy all files therein
70                 cp -vR ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
71         else
72                 # for all regular files just copy them across
73                 cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i
74         fi
75 done
76
77 # Enter the correct values for confdir and logdir into the config file 
78 echo ""
79 echo ""
80 echo "Copy the config file from the '${SOURCE_DIR}' directory, modifying the confdir and logdir in passing"
81 echo ""
82 sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../${SOURCE_DIR}/config > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp
83 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
84 rm -f pkg\ content/usr/local/etc/privoxy/vanilla/config_temp
85
86 # Copy the documentation hierarchy from the '${SOURCE_DIR}' directory
87 echo ""
88 echo ""
89 echo "Copy the documentation hierarchy from the '${SOURCE_DIR}' directory"
90 echo ""
91 # copy the required directory hierarchies
92 for i in developer-manual faq images man-page team user-manual; do
93         cp -vR ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
94 done
95 # copy the top-level files
96 for i in announce.txt p_doc.css privoxy-index.html; do
97         cp -v ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
98 done
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
102 done
103
104 # Copy the manpage from the '${SOURCE_DIR}' directory
105 echo ""
106 echo ""
107 echo "Copy the manpage from the '${SOURCE_DIR}' directory"
108 echo ""
109 cp -v ../${SOURCE_DIR}/privoxy.1 pkg\ content/usr/local/share/man/man1
110
111 # Remove CVS administration files
112 echo ""
113 echo ""
114 echo "Remove CVS administration files"
115 echo ""
116 find pkg\ content -name CVS.sandboxinfo -exec rm -rf {} \;
117 find pkg\ content -name CVS -exec rm -rf {} \;
118