r1: [svn-inject] Installing original source of php4-cn
authorDragan Dosen <ddosen@ffzg.hr>
Thu, 27 Dec 2007 15:35:08 +0000 (15:35 +0000)
committerDragan Dosen <ddosen@ffzg.hr>
Thu, 27 Dec 2007 15:35:08 +0000 (15:35 +0000)
debian/README.CARNet [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/changelog.CARNet [new symlink]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/postinst [new file with mode: 0755]
debian/postrm [new file with mode: 0755]
debian/rules [new file with mode: 0755]

diff --git a/debian/README.CARNet b/debian/README.CARNet
new file mode 100644 (file)
index 0000000..1b3b897
--- /dev/null
@@ -0,0 +1,49 @@
+php4-cn
+-------
+
+Ovaj paket sadrzi dodatne CARNetove postavke za php4 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.
+
+
+PHP4 KONFIGURACIJA
+
+PHP4 konfiguracija nalazi se unutar direktorija /etc/php4/. 
+U slucaju da zelite prepraviti konfiguraciju za Apache2 web 
+server, cinite to u datoteci:
+
+  /etc/php4/apache2/php.ini
+
+Specificne postavke koje php4-cn paket automatski postavlja u
+navedenoj datoteci:
+
+  upload_max_filesize = 256M
+  post_max_size = 256MB
+  memory_limit = 256M
+
+Konfiguracije za pojedine PHP4 dodatke (extensions) nalaze se 
+unutar direktorija /etc/php4/conf.d/.  Preporuka je da NE dirate 
+i da NE brisete iste, osim ako znate sto cinite.
+
+Nakon sto prepravite PHP4 konfiguraciju, potrebno je obaviti
+restart Apache2 web servera:
+
+  invoke-rc.d apache2 restart
+
+
+APACHE2 KONFIGURACIJA
+
+Konfiguracija PHP4 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/php4.conf
+  /etc/apache2/mods-enabled/php4.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>  Thu, 27 Dec 2007 15:50:16 +0100
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..d08200d
--- /dev/null
@@ -0,0 +1,10 @@
+php4-cn (4.4.4-1) stable; urgency=low
+
+  * Inicijalni paket za Debian etch distribuciju.
+  * Automatska aktivacija PHP4 modula za Apache2 web server,
+    automatska deaktivacija PHP5 modula za Apache2 web server.
+  * Aktivacija PHP4 dodataka za MySQL, LDAP i GD - provjera
+    konfiguracije.
+  * Aktivacija specificnih CARNet parametara unutar php.ini.
+
+ -- Dragan Dosen <ddosen@ffzg.hr>  Thu, 27 Dec 2007 15:50:16 +0100
diff --git a/debian/changelog.CARNet b/debian/changelog.CARNet
new file mode 120000 (symlink)
index 0000000..194579e
--- /dev/null
@@ -0,0 +1 @@
+changelog.Debian
\ No newline at end of file
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..b8626c4
--- /dev/null
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..68bf93a
--- /dev/null
@@ -0,0 +1,24 @@
+Source: php4-cn
+Section: web
+Maintainer: Dragan Dosen <ddosen@ffzg.hr>
+Origin: carnet
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.1
+
+Package: php4-cn
+Architecture: all
+Pre-Depends: apache2-cn, apache2.2-common
+Depends: libapache2-mod-php4, php4-cgi, php4-cli, php4-gd, php4-ldap, php4-mysql, libpcre3, carnet-tools-cn (>= 2.4)
+Conflicts: php5-cn
+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 PHP4 interpreter
+ installed.  Removing this package won't remove PHP4 from your system, 
+ however it may remove other packages that depend on this one.
+ .
+ PHP4 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.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..24d27ef
--- /dev/null
@@ -0,0 +1,2 @@
+debian/README.CARNet
+debian/changelog.CARNet
diff --git a/debian/postinst b/debian/postinst
new file mode 100755 (executable)
index 0000000..5a3279c
--- /dev/null
@@ -0,0 +1,189 @@
+#!/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="php4-cn"
+A2MODEDIR="/etc/apache2/mods-enabled"
+EXTENSIONS="mysql ldap gd"
+PHP4DIR="/etc/php4"
+PHP4CONFD="/etc/php4/conf.d"
+
+need_restart=0
+
+
+# Disable PHP5 module and enable Apache2 PHP4 module.
+#
+if [ -e /etc/apache2/apache2.conf ]; then
+       if [ -e "$A2MODEDIR/php5.load" ]; then
+               cp_echo "CN: Disabling PHP5 module for Apache2 web server"
+               a2dismod php5 >/dev/null || true
+               need_restart=1
+       fi
+       if [ ! -e "$A2MODEDIR/php4.load" ] || [ ! -e "$A2MODEDIR/php4.conf" ]; then
+               cp_echo "CN: Enabling PHP4 module for Apache2 web server"
+               a2enmod php4 >/dev/null || true
+               need_restart=1
+       fi
+fi
+
+
+# Check if PHP4 extensions (MySQL, LDAP, GD) are enabled.
+#
+for php4ext in $EXTENSIONS; do
+
+        php4ext_re="^[[:space:]]*extension[[:space:]]*=[[:space:]]*$php4ext\.so"
+
+       # Remove extension entry from /etc/php4/(apache|apache2|cgi|cli).ini
+       # configuration files.
+        for SAPI in apache apache2 cgi cli; do
+
+                ini_file="$PHP4DIR/$SAPI/php.ini"
+
+                if [ -f "$ini_file" ]; then
+
+                       cp_echo "CN: Removing $php4ext extension from file $ini_file"
+
+                       cp_check_and_sed "$php4ext_re" \
+                               "/$php4ext_re/d" \
+                               "$ini_file" && need_restart=1 || true
+                fi
+        done
+
+       # Check extension configuration in /etc/php4/conf.d/ directory.
+       if [ ! -f "$PHP4CONFD/$php4ext.ini" ]; then
+
+               cp_echo "CN: Creating configuration file $PHP4CONFD/$php4ext.ini"
+               
+               php4ext_up=`echo $php4ext | tr [:lower:] [:upper:] | sed 's/Y/y/'`
+               INITMP=`mktemp $PHP4CONFD/$php4ext.ini.tmp.XXXXXX`
+
+               cp_echo "CN: Adding $php4ext extension to file $PHP4CONFD/$php4ext.ini"
+               
+               echo -e "# configuration for php $php4ext_up module\nextension=$php4ext.so" >> "$INITMP"
+               cp_mv "$INITMP" "$PHP4CONFD/$php4ext.ini"
+               
+               need_restart=1
+       else
+
+               if ! grep -q "$php4ext_re" "$PHP4CONFD/$php4ext.ini"; then
+
+                       cp_echo "CN: Adding $php4ext extension to file $PHP4CONFD/$php4ext.ini"
+                       
+                       INITMP=`mktemp $PHP4CONFD/$php4ext.ini.tmp.XXXXXX`
+                       cat "$PHP4CONFD/$php4ext.ini" > "$INITMP"
+                       echo "extension=$php4ext.so" >> "$INITMP"
+                       cp_mv "$INITMP" "$PHP4CONFD/$php4ext.ini"
+                       
+                       need_restart=1
+               fi
+       fi
+done
+
+
+# Enable some PHP4 tweaks for Apache2 web server (/etc/php4/apache2/php.ini).
+#
+#   * upload_max_filesize = 256M
+#   * post_max_size = 256M
+#   * memory_limit = 256M
+#
+for SAPI in apache apache2 cgi cli; do
+
+       ini_file="$PHP4DIR/$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
diff --git a/debian/postrm b/debian/postrm
new file mode 100755 (executable)
index 0000000..c5f4fc5
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = purge -a -e /usr/share/debconf/confmodule ]; then
+        . /usr/share/debconf/confmodule
+        db_purge
+fi
+
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..e7f422a
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+#export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+       touch build-stamp
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_install -X.svn
+#      dh_installexamples
+#      dh_install
+#      dh_installmenu
+       dh_installdebconf
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+#      dh_strip
+       dh_compress
+       dh_fixperms
+#      dh_perl
+#      dh_python
+#      dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure