--- /dev/null
+#!/bin/sh
+
+# File : constructPkgContent.sh
+#
+# Purpose : Create the hierarchy of folders and files that will
+# comprise the installation package and zip them.
+#
+# Copyright : Written by and Copyright (C) 2001-2013 the
+# Privoxy team. http://www.privoxy.org/
+#
+# This program is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# The GNU General Public License should be included with
+# this file. If not, you can view it at
+# http://www.gnu.org/copyleft/gpl.html
+# or write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA
+#
+# Modification : If you modify this file please consider whether your
+# changes ought to be passed back to the iOSPackageBuilder
+# module.
+#
+
+# Use the common script to locate the directory containing Privoxy's source ($SOURCEDIR)
+. ./common.sh
+
+# Remove existing 'pkg content' folder if found
+echo ""
+echo "Remove existing 'pkg content' folder if found"
+rm -rf pkg\ content
+
+# Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'
+echo ""
+echo "Copy the package skeleton (the unchanging content) to a new folder named 'pkg content'"
+echo ""
+cp -vR pkg\ content\ skeleton pkg\ content
+
+# Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory
+echo ""
+echo ""
+echo "Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory"
+echo ""
+cp -v ../${SOURCE_DIR}/privoxy pkg\ content/usr/local/sbin
+
+# Copy the configuration hierarchy from the '${SOURCE_DIR}' directory
+echo ""
+echo ""
+echo "Copy most of the configuration hierarchy from the '${SOURCE_DIR}' directory"
+echo ""
+for i in default.action default.filter match-all.action trust user.action user.filter templates; do
+ if [ "$i" = "templates" ]; then
+ # for the templates subfolder copy all files therein
+ cp -vR ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/$i
+ else
+ # for all regular files just copy them across
+ cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/$i
+ fi
+done
+
+# Enter the correct values for confdir, logdir and enable-edit-actions into the config file
+echo ""
+echo ""
+echo "Copy the config file from the '${SOURCE_DIR}' directory, modifying confdir, logdir and enable-edit-actions in passing"
+echo ""
+sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../${SOURCE_DIR}/config > pkg\ content/usr/local/etc/privoxy/config_temp
+sed 's/logdir ./logdir \/var\/log\/privoxy/g' pkg\ content/usr/local/etc/privoxy/config_temp > pkg\ content/usr/local/etc/privoxy/config_temp2
+sed 's/enable-edit-actions 0/enable-edit-actions 1/g' pkg\ content/usr/local/etc/privoxy/config_temp2 > pkg\ content/usr/local/etc/privoxy/config
+rm -f pkg\ content/usr/local/etc/privoxy/config_temp
+rm -f pkg\ content/usr/local/etc/privoxy/config_temp2
+
+# Copy the documentation hierarchy from the '${SOURCE_DIR}' directory
+echo ""
+echo ""
+echo "Copy the documentation hierarchy from the '${SOURCE_DIR}' directory"
+echo ""
+# copy the required directory hierarchies
+for i in developer-manual faq images man-page team user-manual; do
+ cp -vR ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
+done
+# copy the top-level files
+for i in announce.txt p_doc.css privoxy-index.html; do
+ cp -v ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i
+done
+# copy the project's AUTHORS, ChangeLog, LICENSE and README files
+for i in AUTHORS ChangeLog LICENSE README; do
+ cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/share/doc/privoxy/$i
+done
+
+# Copy the manpage from the '${SOURCE_DIR}' directory
+echo ""
+echo ""
+echo "Copy the manpage from the '${SOURCE_DIR}' directory"
+echo ""
+cp -v ../${SOURCE_DIR}/privoxy.1 pkg\ content/usr/local/share/man/man1
+
+# Optionally copy the PCRE libraries
+if [ "$1" == "-pcre" ]; then
+ echo ""
+ echo ""
+ echo "Copy the external PCRE libraries"
+ echo ""
+ mkdir pkg\ content/usr/local/lib
+ cp -v /usr/local/lib/libpcre* pkg\ content/usr/local/lib
+ mkdir pkg\ content/usr/local/lib/pkgconfig
+ cp -v /usr/local/lib/pkgconfig/libpcre* pkg\ content/usr/local/lib/pkgconfig
+fi
+
+# Remove CVS administration files
+echo ""
+echo ""
+echo "Remove CVS administration files"
+echo ""
+find pkg\ content -name CVS.sandboxinfo -exec rm -rf {} \;
+find pkg\ content -name CVS -exec rm -rf {} \;
+
+# Build zip file
+cd pkg\ content
+zip -r org.ijbswa.privoxy.zip *
+cd ..