--- /dev/null
+php5-cn
+-------
+
+Ovaj paket sadrzi dodatne CARNetove postavke za php5 pakete iz
+Debian etch distribucije. Povlaci za sobom instalaciju MySQL,
+GD i LDAP dodataka (extensions), PHP interpretera za komandnu
+liniju i PHP modula za Apache2 web server.
+
+
+PHP5 KONFIGURACIJA
+
+PHP5 konfiguracija nalazi se unutar direktorija /etc/php5/.
+U slucaju da zelite prepraviti konfiguraciju za Apache2 web
+server, cinite to u datoteci:
+
+ /etc/php5/apache2/php.ini
+
+Specificne postavke koje php5-cn paket automatski postavlja u
+navedenoj datoteci:
+
+ upload_max_filesize = 256M
+ post_max_size = 256MB
+ memory_limit = 256M
+
+Konfiguracije za pojedine PHP5 dodatke (extensions) nalaze se
+unutar direktorija /etc/php5/conf.d/. Preporuka je da NE dirate
+i da NE brisete iste, osim ako znate sto cinite.
+
+Nakon sto prepravite PHP5 konfiguraciju, potrebno je obaviti
+restart Apache2 web servera:
+
+ invoke-rc.d apache2 restart
+
+
+APACHE2 KONFIGURACIJA
+
+Konfiguracija PHP5 modula za Apache2 web server nalazi se u
+direktoriju /etc/apache2/mods-available/, odnosno u direktoriju
+/etc/apache2/mods-enabled/. Radi se o datotekama:
+
+ /etc/apache2/mods-enabled/php5.conf
+ /etc/apache2/mods-enabled/php5.load
+
+Kako bi Vas Apache2 web server mogao normalno posluzivati
+stranice pisane u PHP-u, preporuca se da NE brisete i da ne
+uredjujete navedene datoteke, osim ako znate sto cinite.
+
+
+ -- Dragan Dosen <ddosen@ffzg.hr> Sat, 27 Oct 2007 15:51:58 +0200
--- /dev/null
+Source: php5-cn
+Section: web
+Maintainer: Dragan Dosen <ddosen@ffzg.hr>
+Origin: carnet
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.1
+
+Package: php5-cn
+Architecture: all
+Pre-Depends: apache2-cn, apache2.2-common
+Depends: libapache2-mod-php5, php5-cgi, php5-cli, php5-gd, php5-ldap, php5-mysql, libpcre3, carnet-tools-cn (>= 2.4)
+Description: server-side, HTML-embedded scripting language (CARNet configuration)
+ This package is a meta-package that, when installed, guarantees that you
+ have at least one of the four server-side versions of the PHP5 interpreter
+ installed. Removing this package won't remove PHP5 from your system, however
+ it may remove other packages that depend on this one.
+ .
+ PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
+ from C, Java and Perl with a couple of unique PHP-specific features thrown
+ in. The goal of the language is to allow web developers to write dynamically
+ generated pages quickly.
+ .
+ This package contains additional CARNet configuration.
--- /dev/null
+#!/bin/sh
+
+set -e
+
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+case "$1" in
+ configure)
+ # continue below
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ exit 0
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 0
+ ;;
+esac
+
+
+# Include CARNet functions
+. /usr/share/carnet-tools/functions.sh
+
+PKG="php5-cn"
+A2MODEDIR="/etc/apache2/mods-enabled"
+EXTENSIONS="mysql ldap gd"
+PHP5DIR="/etc/php5"
+PHP5CONFD="/etc/php5/conf.d"
+
+need_restart=0
+
+
+# Disable PHP4 module and enable Apache2 PHP5 module.
+#
+if [ -e /etc/apache2/apache2.conf ]; then
+ if [ -e "$A2MODEDIR/php4.load" ]; then
+ cp_echo "CN: Disabling PHP4 module for Apache2 web server"
+ a2dismod php4 >/dev/null || true
+ need_restart=1
+ fi
+ if [ ! -e "$A2MODEDIR/php5.load" ] || [ ! -e "$A2MODEDIR/php5.conf" ]; then
+ cp_echo "CN: Enabling PHP5 module for Apache2 web server"
+ a2enmod php5 >/dev/null || true
+ need_restart=1
+ fi
+fi
+
+
+# Check if PHP5 extensions (MySQL, LDAP, GD) are enabled.
+#
+for php5ext in $EXTENSIONS; do
+
+ php5ext_re="^[[:space:]]*extension[[:space:]]*=[[:space:]]*$php5ext\.so"
+
+ # Remove extension entry from /etc/php5/(apache|apache2|cgi|cli).ini
+ # configuration files.
+ for SAPI in apache apache2 cgi cli; do
+
+ ini_file="$PHP5DIR/$SAPI/php.ini"
+
+ if [ -f "$ini_file" ]; then
+
+ cp_echo "CN: Removing $php5ext extension from file $ini_file"
+
+ cp_check_and_sed "$php5ext_re" \
+ "/$php5ext_re/d" \
+ "$ini_file" && need_restart=1 || true
+ fi
+ done
+
+ # Check extension configuration in /etc/php5/conf.d/ directory.
+ if [ ! -f "$PHP5CONFD/$php5ext.ini" ]; then
+
+ cp_echo "CN: Creating configuration file $PHP5CONFD/$php5ext.ini"
+
+ php5ext_up=`echo $php5ext | tr [:lower:] [:upper:] | sed 's/Y/y/'`
+ INITMP=`mktemp $PHP5CONFD/$php5ext.ini.tmp.XXXXXX`
+
+ cp_echo "CN: Adding $php5ext extension to file $PHP5CONFD/$php5ext.ini"
+
+ echo -e "# configuration for php $php5ext_up module\nextension=$php5ext.so" >> "$INITMP"
+ cp_mv "$INITMP" "$PHP5CONFD/$php5ext.ini"
+
+ need_restart=1
+ else
+
+ if ! grep -q "$php5ext_re" "$PHP5CONFD/$php5ext.ini"; then
+
+ cp_echo "CN: Adding $php5ext extension to file $PHP5CONFD/$php5ext.ini"
+
+ INITMP=`mktemp $PHP5CONFD/$php5ext.ini.tmp.XXXXXX`
+ cat "$PHP5CONFD/$php5ext.ini" > "$INITMP"
+ echo "extension=$php5ext.so" >> "$INITMP"
+ cp_mv "$INITMP" "$PHP5CONFD/$php5ext.ini"
+
+ need_restart=1
+ fi
+ fi
+done
+
+
+# Enable some PHP5 tweaks for Apache2 web server (/etc/php5/apache2/php.ini).
+#
+# * upload_max_filesize = 256M
+# * post_max_size = 256M
+# * memory_limit = 256M
+#
+for SAPI in apache apache2 cgi cli; do
+
+ ini_file="$PHP5DIR/$SAPI/php.ini"
+
+ cp_echo "CN: Checking and enabling some CARNet specific parameters in file $ini_file"
+
+ if [ -f "$ini_file" ]; then
+
+ cp_check_and_sed "^[[:space:]]*upload_max_filesize[[:space:]]*=[[:space:]]*2M$" \
+ 's/^[[:space:]]*upload_max_filesize[[:space:]]*=.*/upload_max_filesize = 256M/' \
+ "$ini_file" && need_restart=1 || true
+
+ cp_check_and_sed "^[[:space:]]*post_max_size[[:space]]*=[[:space:]]*8M$" \
+ 's/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = 256M/' \
+ "$ini_file" && need_restart=1 || true
+
+ cp_check_and_sed "^[[:space:]]*memory_limit[[:space:]]*=[[:space:]]*16M$" \
+ 's/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = 256M/' \
+ "$ini_file" && need_restart=1 || true
+ fi
+
+ ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX`
+ if [ -f "$ini_file" ]; then
+ cat $ini_file > $ini_file_tmp
+ fi
+
+ if ! egrep -q "^[[:space:]]*(upload_max_filesize|post_max_size|memory_limit)[[:space:]]*=" $ini_file_tmp; then
+
+ if ! egrep -q "^[[:space:]]*upload_max_filesize[[:space:]]*=" $ini_file_tmp; then
+ echo "upload_max_filesize = 256M" >> "$ini_file_tmp"
+ fi
+ if ! egrep -q "^[[:space:]]*post_max_size[[:space:]]*=" $ini_file_tmp; then
+ echo "post_max_size = 256MB" >> "$ini_file_tmp"
+ fi
+ if ! egrep -q "^[[:space:]]*memory_limit[[:space:]]*=" $ini_file_tmp; then
+ echo "memory_limit = 256M" >> "$ini_file_tmp"
+ fi
+ cp_mv "$ini_file_tmp" "$ini_file"
+
+ need_restart=1
+ fi
+
+ if [ -e "$ini_file_tmp" ]; then
+ rm -f "$ini_file_tmp"
+ fi
+done
+
+
+# Restart Apache2 web server if needed.
+#
+if [ $need_restart -eq 1 ]; then
+
+ # Check Apache2 web server configuration.
+ if apache2ctl configtest 2>/dev/null; then
+
+ # Restart Apache2 web server.
+ if [ -x "/etc/init.d/apache2" ]; then
+ if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+ invoke-rc.d apache2 restart || exit $?
+ else
+ /etc/init.d/apache2 restart || exit $?
+ fi
+ fi
+ else
+
+ # Something is broken.
+ cp_echo "CN: Your Apache2 configuration is broken."
+ cp_echo "CN: Please, check the service after the installation finishes!"
+ fi
+fi
+
+
+# Mail root
+#
+cp_mail "$PKG"
+
+exit 0