From 8f277d4e7b7b056b6b7a90aef559540683966591 Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Wed, 11 Nov 2020 14:48:10 +0100 Subject: [PATCH] Inicijalna verzija paketa. --- README.CARNET | 60 ++++++++ debian/changelog | 170 ++++++++++++++++++++++ debian/compat | 1 + debian/config | 108 ++++++++++++++ debian/control | 24 ++++ debian/copyright | 7 + debian/docs | 1 + debian/po/POTFILES.in | 1 + debian/po/templates.pot | 185 ++++++++++++++++++++++++ debian/postinst | 356 +++++++++++++++++++++++++++++++++++++++++++++++ debian/postrm | 7 + debian/rules | 3 + debian/source/format | 1 + debian/templates | 84 +++++++++++ 14 files changed, 1008 insertions(+) create mode 100644 README.CARNET create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100755 debian/config create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/po/POTFILES.in create mode 100644 debian/po/templates.pot create mode 100755 debian/postinst create mode 100755 debian/postrm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/templates diff --git a/README.CARNET b/README.CARNET new file mode 100644 index 0000000..3ed4c0d --- /dev/null +++ b/README.CARNET @@ -0,0 +1,60 @@ +php7.3-cn +~~~~~~~~~ + +Ovaj paket sadrzi dodatne CARNETove postavke za php pakete iz Debian +stretch distribucije. Povlaci za sobom instalaciju dodatka za MySQL +(extension), PHP interpretera za komandnu liniju i PHP modula za web +server Apache2. + + +PHP7 KONFIGURACIJA + +PHP7 konfiguracija nalazi se unutar direktorija /etc/php/7.3/. +U slucaju da zelite prepraviti konfiguraciju za Apache2 web +server, cinite to u datoteci: + + /etc/php/7.3/apache2/php.ini + +Specificne postavke koje paket php7.3-cn postavlja u navedenoj +datoteci: + + upload_max_filesize = 256M + post_max_size = + memory_limit = + error_reporting = E_ERROR + +post_max_size i memory_limit postavke se odredjuju ovisno o +kolicini memorije na posluzitelju, tocnije: + + * manje od 512MB => ogranicenje 16MB, + * 512-1024MB => ogranicenje 32MB, + * vise od 1024MB => ogranicenje 64MB. + +U slucaju da na posluzitelju postoji PHP7 konfiguracija koja +se razlikuje od navedene, bit cete upitani zelite li zadrzati +trenutne postavke ili aktivirati preporucene. + +Nakon sto prepravite PHP7 konfiguraciju, potrebno je obaviti +restart Apache2 web servera: + + service apache2 restart + + +APACHE2 KONFIGURACIJA + +Konfiguracija modula PHP7 za web server Apache2 nalazi se u +direktoriju /etc/apache2/mods-available/, odnosno u direktoriju +/etc/apache2/mods-enabled/. Radi se o datotekama: + + /etc/apache2/mods-enabled/php7.3.conf + /etc/apache2/mods-enabled/php7.3.load + +Kako bi Vas web server Apache2 mogao normalno posluzivati +stranice pisane u PHP-u, preporuca se da NE brisete i da ne +uredjujete navedene datoteke, osim ako znate sto cinite. + +Zbog sigurnosnih razloga, paket libapache2-mod-php7.3 onemogucuje +PHP7 za ~/public_html direktorije ako je omogucen mod_userdir +modul za Apache2. + + -- Ivan Rako Wed, 10 Jul 2019 17:02:59 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..66f2ef8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,170 @@ +php7.3-cn (7.3.19+cn10u1) stable; urgency=low + + * Prva verzija za buster + * Promjena imena u php7.3-cn + + -- Ivan Rako Wed, 11 Nov 2020 14:24:36 +0100 + +php7.0-cn (7.0.33~cn0) stable; urgency=low + + * Prva verzija za stretch + * Promjena imena u php7.0-cn + + -- Ivan Rako Wed, 10 Jul 2019 16:58:12 +0200 + +php5-cn (5.6.24.1) stable; urgency=low + + * Prva inacica za jessie + + -- Zeljko Boros Tue, 06 Sep 2016 11:29:24 +0200 + +php5-cn (5.4.4+4) stable; urgency=low + + * tag fix + + -- Zeljko Boros Thu, 07 Nov 2013 13:51:30 +0100 + +php5-cn (5.4.4+3) stable; urgency=low + + * debhelper >= 9 + * Izbaceno dodavanje ekstenzije mysql u /etc/php5/conf.d/php.ini + * Dodano brisanje _obsolete_ datoteke php.ini + + -- Zeljko Boros Thu, 07 Nov 2013 12:41:30 +0100 + +php5-cn (5.4.4+2) stable; urgency=low + + * Ispravke za lintian. + + -- Valentin Vidic Tue, 22 Oct 2013 11:17:14 +0200 + +php5-cn (5.4.4+1) stable; urgency=low + + * Nova verzija za wheezy: izbacen suhosin paket. + * Ispravljena greska u predlosku. + + -- Valentin Vidic Thu, 17 Oct 2013 14:53:04 +0200 + +php5-cn (5.3.3+3) stable; urgency=low + + * Provjera vrijednosti za error_reporting unutar php.ini datoteka. + * Provjera da li je PHP5 onemogucen za neke direktorije unutar + konfiguracijske datoteke /etc/apache2/mods-enabled/php5.conf. + + -- Dragan Dosen Mon, 13 Jun 2011 17:40:42 +0200 + +php5-cn (5.3.3+2) stable; urgency=low + + * Promjena e-mail adrese odrzavatelja paketa. + + -- Dragan Dosen Sat, 30 Apr 2011 12:43:54 +0200 + +php5-cn (5.3.3+1) stable; urgency=low + + * Prva inacica paketa za Debian squeeze distribuciju. + * Nova debian/rules datoteka. + * Azurirane ovisnosti unutar debian/control. + * Razni Lintian popravci, dodan copyright, promjena inacice + paketa u Debian native. + * Azurirana debian/templates datoteka. + + -- Dragan Dosen Fri, 29 Apr 2011 15:51:33 +0200 + +php5-cn (5.2.6-1) stable; urgency=low + + * Upgrade paketa za Debian lenny. + * Podesene nove ovisnosti u debian/control, dodana preporuka + za php-apc. + * Umjesto 'apache2 force-reload' koristi se 'apache2 restart'. + + -- Dragan Dosen Sat, 18 Apr 2009 19:42:19 +0200 + +php5-cn (5.2.0-7) stable; urgency=low + + * Paket za buduci prelazak na Debian Lenny. + * debian/postinst datoteka: + + u slucaju da na sustavu postoji PHP4 konfiguracija, obavlja + se provjera aktivnih dodataka za PHP4 - korisnik je + informiran ako odgovarajuci dodaci nisu aktivirani za PHP5. + * debian/templates datoteka: + + novi predlozak php5-cn/extensions, + + manje izmjene za predlozak php5-cn/inivalues. + * debian/control datoteka: + + dodana ovisnost o findutils paketu. + + -- Dragan Dosen Wed, 11 Feb 2009 20:13:35 +0100 + +php5-cn (5.2.0-6) stable; urgency=low + + * debian/postinst datoteka: + + provjera ispravnosti za postavke unutar php.ini + konfiguracijske datoteke - vrijednosti za postavke kao sto + su upload_max_filesize, post_max_size, memory_limit, ne + smiju zavrsavati sa 'B'; dozvoljene oznake su 'K' (kilo), + 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte' - korisnik je + informiran da provjeri konfiguraciju. (rijeseno: #3938) + + koristi se debconf-escape za ispis pogresno podesenih + postavki unutar php.ini datoteke. + * debian/control - ovisnost o debconf (>= 1.4.72). + + -- Dragan Dosen Tue, 2 Sep 2008 21:29:03 +0200 + +php5-cn (5.2.0-5) stable; urgency=medium + + * dodana config skripta: + + usporedba trenutno aktivnih PHP5 postavki s onima koje + preporuca CARNet (upload_max_filesize, post_max_size, + memory_limit) + + koristi se debconf - u slucaju da se postavke razlikuju, + korisnik odlucuje zeli li zadrzati trenutne postavke ili + aktivirati preporucene + * config i postinst skripta - preporucene vrijednosti za + post_max_size i memory_limit postavke odredjuju se ovisno o + kolicini memorije na posluzitelju. + * u slucaju da ne postoji neka od php.ini datoteka, koristi + se /usr/share/php5/php.ini-dist za kreiranje nove. + * podesavanje postavki (php.ini datoteka/e) odvija se samo kod + prve instalacije paketa ili u slucaju da se pokrene + dpkg-reconfigure. + * README.CARNet datoteka - opisano odredjivanje preporucene + vrijednosti za post_max_size i memory_limit postavke. + * provjera dozvola pristupa za svaku PHP5 konfiguracijsku + datoteku (file access permissions, chmod 644). + + -- Dragan Dosen Sun, 30 Mar 2008 22:10:32 +0200 + +php5-cn (5.2.0-4) stable; urgency=low + + * control datoteka - uklonjene ovisnosti o php5-cgi, php5-gd, + php5-ldap i libpcre3. + * izmjene unutar postinst skripte - vrsi se podesavanje samo + MySQL PHP5 dodatka (extension), posto vise ne ovisimo o + LDAP i GD. + * manje izmjene unutar README.CARNet datoteke. + + -- Dragan Dosen Sun, 27 Jan 2008 14:54:24 +0100 + +php5-cn (5.2.0-3) stable; urgency=low + + * control datoteka, uklonjeno: + Pre-Depends: apache2-cn, apache2.2-common + + -- Dragan Dosen Wed, 9 Jan 2008 14:33:16 +0100 + +php5-cn (5.2.0-2) stable; urgency=low + + * control datoteka, dodano: Conflicts: php4-cn + + -- Dragan Dosen Thu, 27 Dec 2007 16:59:15 +0100 + +php5-cn (5.2.0-1) stable; urgency=low + + * Inicijalni paket za Debian etch distribuciju + * Automatska aktivacija PHP5 modula za Apache2 web server; + PHP4 modul se vise ne koristi. + * Aktivacija PHP5 dodataka za MySQL, LDAP i GD - provjera + konfiguracije. + * Aktivacija specificnih CARNet parametara unutar php.ini. + + -- Dragan Dosen Sat, 27 Oct 2007 15:51:58 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/config b/debian/config new file mode 100755 index 0000000..436ee4b --- /dev/null +++ b/debian/config @@ -0,0 +1,108 @@ +#!/bin/sh + +set -e + +# Load debconf +. /usr/share/debconf/confmodule + +if [ "$1" != reconfigure ]; then + + php73_done=1 + + for SAPI in apache2 cli; do + db_fget php7.3-cn/${SAPI} seen + if [ "$RET" != "true" ]; then + php73_done=0 + break + fi + done + + test $php73_done -eq 1 && exit 0 +fi + +PHP73DIR="/etc/php/7.3" + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + echo $memlimit +} + + +# Check for PHP5 SAPI configuration. +# +for SAPI in apache2 cli; do + + ini_diff=0 + ini_file="$PHP73DIR/$SAPI/php.ini" + + upload_max_filesize= + post_max_size= + memory_limit= + error_reporting= + + phplimit="$(phpmemlimit)M" + + if [ -f "$ini_file" ]; then + + if egrep -q "^[[:space:]]*(upload_max_filesize|post_max_size|memory_limit|error_reporting)[[:space:]]*=" $ini_file; then + + upload_max_filesize=`awk '$1 == "upload_max_filesize" { print $3; exit(0) }' $ini_file` + post_max_size=`awk '$1 == "post_max_size" { print $3; exit(0) }' $ini_file` + memory_limit=`awk '$1 == "memory_limit" { print $3; exit(0) }' $ini_file` + error_reporting=`awk '$1 == "error_reporting" { print $3; exit(0) }' $ini_file` + + if [ "$upload_max_filesize" != "256M" ]; then ini_diff=1; fi + if [ "$post_max_size" != "$phplimit" ]; then ini_diff=1; fi + if [ "$memory_limit" != "$phplimit" ]; then ini_diff=1; fi + if [ "$error_reporting" != "E_ERROR" ]; then ini_diff=1; fi + else + + ini_diff=1 + fi + else + + ini_diff=1 + fi + + if [ $ini_diff -eq 1 ]; then + + # Configurations are not the same - ask user what to do. + test -z "$upload_max_filesize" && upload_max_filesize="2M" + test -z "$post_max_size" && post_max_size="8M" + test -z "$memory_limit" && memory_limit="16M" + test -z "$error_reporting" && error_reporting="E_ALL & ~E_DEPRECATED" + + db_title php7.3-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.3-cn/${SAPI} ini_file "$ini_file" + + db_subst php7.3-cn/${SAPI} upload_max_filesize "$upload_max_filesize" + db_subst php7.3-cn/${SAPI} post_max_size "$post_max_size" + db_subst php7.3-cn/${SAPI} memory_limit "$memory_limit" + + db_subst php7.3-cn/${SAPI} new_phplimit "$phplimit" + + db_subst php7.3-cn/${SAPI} error_reporting "$error_reporting" + db_subst php7.3-cn/${SAPI} new_error_reporting "E_ERROR" + + db_input critical php7.3-cn/${SAPI} || true + db_go || true + else + + db_set php7.3-cn/${SAPI} false || true + db_fset php7.3-cn/${SAPI} seen true + fi + +done + +exit 0 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1ec9cf3 --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: php7.3-cn +Section: php +Priority: optional +Maintainer: Ivan Rako +Uploaders: Valentin Vidic , Zeljko Boros +Build-Depends: debhelper (>= 10), po-debconf +Standards-Version: 3.9.8 + +Package: php7.3-cn +Architecture: all +Pre-Depends: findutils (>= 4.6.0+git+20161106-2) +Depends: libapache2-mod-php7.0 (>= 7.3.19-1~deb10u1), php7.0-cli (>= 7.3.19-1~deb10u1), php7.0-mysql (>= 7.3.19-1~deb10u1), carnet-tools-cn (>= 3.3.0), ${misc:Depends} +Conflicts: php4-cn, php5-cn, php7.0-cn +Description: server-side, HTML-embedded scripting language + PHP7 is a widely-used general-purpose scripting language that is + especially suited for Web development and can be embedded into HTML. + The goal of the language is to allow web developers to write + dynamically generated pages quickly. This version of PHP7 was built + with the Suhosin patch. + . + This package is a meta-package that contains additional CARNET configuration. + Removing this package won't remove PHP7 from your system, however it may + remove other packages that depend on this one. +Homepage: http://www.php.net/ diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..c6f9b3d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,7 @@ +Copyright 2011 CARNET + +You are free to distribute this software package under the terms of the +GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file /usr/share/common-licenses/GPL. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..db3c4b3 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.CARNET diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 0000000..cef83a3 --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 0000000..877736f --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,185 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the php7.3-cn package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: php7.3-cn\n" +"Report-Msgid-Bugs-To: php7.3-cn@packages.debian.org\n" +"POT-Creation-Date: 2020-11-11 14:40+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../templates:1001 +msgid "Zelite li aktivirati preporucene PHP7.3 postavke za Apache2?" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:1001 +msgid "" +"Provjerom trenutne PHP7.3 konfiguracije za Apache2 (konfiguracijska " +"datoteka ${ini_file}), ustanovljeno je da su sljedece postavke aktivne:" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "" +" upload_max_filesize = ${upload_max_filesize}\n" +" post_max_size = ${post_max_size}\n" +" memory_limit = ${memory_limit}\n" +" error_reporting = ${error_reporting}" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "Preporucamo sljedece:" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "" +" upload_max_filesize = 256M\n" +" post_max_size = ${new_phplimit}\n" +" memory_limit = ${new_phplimit}\n" +" error_reporting = ${new_error_reporting}" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "Zelite li aktivirati preporucene PHP7.3 postavke za CLI?" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "" +"Provjerom trenutne PHP7.3 konfiguracije za CLI (PHP interpreter za komandnu " +"liniju, konfiguracijska datoteka ${ini_file}), ustanovljeno je da su " +"sljedece postavke aktivne:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "Postavke unutar PHP7.3 konfiguracije nisu ispravne" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "" +"Provjerom trenutne PHP7 konfiguracije za ${php73_sapi} (konfiguracijska " +"datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "${php73_inivalues}" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "" +"Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene " +"oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U " +"protivnom, kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako " +"provjerite postavke unutar navedene datoteke kako bi aplikacije (kao sto je " +"Squirrelmail) mogle normalno funkcionirati." +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "Neki dodaci (extensions) za PHP7.3 nisu ukljuceni" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Iako je PHP7.0 uklonjen sa sustava, ostala je njegova konfiguracija. " +"Usporedbom trenutnih PHP7.0 i PHP7.3 konfiguracijskih datoteka, ustanovljeno " +"je da sljedeci PHP7.3 dodaci (extensions) nisu ukljuceni, iako su ukljuceni " +"za PHP7.0:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "${php73_extensions}" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Kako su neki od dodataka ukljuceni u PHP7.0 konfiguraciji, postoji mogucnost " +"da pojedine aplikacije zahtjevaju odgovarajuce dodatke za PHP7.3. " +"Primjerice, ako je u PHP7.0 konfiguraciji bio ukljucen dodatak za LDAP " +"(php7.0-ldap), tada je u PHP7.3 konfiguraciji potrebno ukljuciti PHP7.3 " +"dodatak za LDAP (php7.3-ldap). Molimo, svakako provjerite PHP7.3 postavke " +"kako bi PHP aplikacije koje se koriste na posluzitelju mogle normalno " +"funkcionirati." +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP7.3 " +"ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno " +"ignorirajte ovu poruku." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "PHP7.3 nije omogucen za neke direktorije" +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Provjerom trenutne PHP7.3 konfiguracije za Apache2 (konfiguracijska datoteka " +"${php73_conf}), ustanovljeno je da PHP7.3 nije omogucen za neke direktorije." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Molimo, svakako provjerite postavke unutar navedene konfiguracijske " +"datoteke. Ako ste sigurni da je ovakva konfiguracija ispravna, slobodno " +"ignorirajte ovu poruku." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Zbog sigurnosnih razloga, paket libapache2-mod-php7.3 onemogucuje PHP7.3 za " +"~/public_html direktorije ako je omogucen mod_userdir modul za Apache2." +msgstr "" diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..1cbbb82 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,356 @@ +#!/bin/sh + +set -e + +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx + +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 + + +# Load debconf +. /usr/share/debconf/confmodule + +# Include CARNET functions +. /usr/share/carnet-tools/functions.sh + +PKG="php7.3-cn" +A2MODEDIR="/etc/apache2/mods-enabled" +### mysql je vec ukljucen u wheezyu +### EXTENSIONS="mysql" +EXTENSIONS="" +PHP73DIR="/etc/php/7.3" +PHP73MODADIR="$PHP70DIR/mods-available" +PHP73CONFD="/etc/php/7.3/conf.d" +PHP70DIR="/etc/php/7.0" + +need_restart=0 + + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + echo $memlimit +} + +# phpinivalidate () +# +# Validate php.ini values. +# +phpinivalidate () { + + local ini_file + ini_file="$1" + + awk -F'[[:space:]]*=[[:space:]]*' \ + '/^[[:space:]]*[[:alpha:]_]+[[:space:]]*=[[:space:]]*[[:digit:]]+[MGK]B/ {print $1" = "$2}' \ + "$ini_file" +} + + +# Disable PHP5 module and enable Apache2 PHP7 module. +# +if [ -e /etc/apache2/apache2.conf ]; then + if [ -e "$A2MODEDIR/php7.0.load" ]; then + cp_echo "CN: Disabling PHP7.0 module for Apache2 web server" + a2dismod php7.0 >/dev/null || true + need_restart=1 + fi + if [ ! -e "$A2MODEDIR/php7.3.load" ] || [ ! -e "$A2MODEDIR/php7.3.conf" ]; then + cp_echo "CN: Enabling PHP7.3 module for Apache2 web server" + a2enmod php7.3 >/dev/null || true + + if [ -e "$A2MODEDIR/php7.3.conf" ]; then + if egrep -qi "^[[:space:]]*php_admin_value engine Off" "$A2MODEDIR/php7.3.conf"; then + db_fset php7.3-cn/userdir seen false + db_title php7.3-cn - konfiguracija + db_subst php7.3-cn/userdir php70_conf "$A2MODEDIR/php7.0.conf" + db_input critical php7.3-cn/userdir || true + db_go || true + fi + fi + + need_restart=1 + fi +fi + + +# Check for PHP7.3 SAPI directories and configuration files. +# +for SAPI in apache2 cli; do + + if [ ! -d "$PHP73DIR/$SAPI" ]; then + cp_echo "CN: Creating configuration directory $PHP73DIR/$SAPI/" + mkdir -p $PHP73DIR/$SAPI/ + fi + + ini_file="$PHP73DIR/$SAPI/php.ini" + + if [ ! -f "$ini_file" ]; then + + cp_echo "CN: Generating configuration file $ini_file" + + ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX` + if [ "$SAPI" = "cli" ]; then + if [ -f "/usr/lib/php/7.3/php.ini-production.cli" ]; then + cat /usr/lib/php/7.3/php.ini-production.cli > $ini_file_tmp + fi + else + if [ -f "/usr/lib/php/7.3/php.ini-production" ]; then + cat /usr/lib/php/7.3/php.ini-production > $ini_file_tmp + fi + fi + cp_mv $ini_file_tmp $ini_file + need_restart=1 + fi + chmod 644 $ini_file +done + + +# Check for /etc/php/7.3/conf.d/ directory. +# +if [ ! -d "$PHP73CONFD" ]; then + cp_echo "CN: Creating configuration directory $PHP73CONFD" + mkdir -p $PHP73CONFD/ +fi + +# Brisanje obsolete datoteke mysql.ini u $PHP73CONFD +# +if [ -f "$PHP73CONFD/mysql.ini" ]; then + # just to make sure mysql is included in _new-style_ configuration + if [ -f "$PHP73MODADIR/mysql.ini" ]; then + cp_echo "CN: Removing obsolete $PHP73CONFD/mysql.ini" + rm -f $PHP73CONFD/mysql.ini + else + cp_echo "CN: WARNING: Obsolete $PHP73CONFD/mysql.ini present, and no $PHP73MODADIR/mysql.ini!" + fi +fi + +# Check if PHP7.3 extensions are enabled. +# +for php73ext in $EXTENSIONS; do + + php73ext_re="^[[:space:]]*extension[[:space:]]*=[[:space:]]*$php70ext\.so" + + # Remove extension entry from /etc/php/7.3/(apache2|cli).ini + # configuration files. + for SAPI in apache2 cli; do + + ini_file="$PHP73DIR/$SAPI/php.ini" + + if [ -f "$ini_file" ]; then + + if egrep -q "$php73ext_re" "$ini_file"; then + cp_echo "CN: Removing $php73ext extension from file $ini_file" + fi + + cp_check_and_sed "$php73ext_re" \ + "/$php73ext_re/d" \ + "$ini_file" && need_restart=1 || true + fi + done + + # Check extension configuration in /etc/php/7.3/conf.d/ directory. + if [ ! -f "$PHP70CONFD/$php73ext.ini" ]; then + + cp_echo "CN: Creating configuration file $PHP73CONFD/$php73ext.ini" + + php70ext_up=`echo $php73ext | tr [:lower:] [:upper:] | sed 's/Y/y/'` + INITMP=`mktemp $PHP73CONFD/$php73ext.ini.tmp.XXXXXX` + + cp_echo "CN: Adding $php73ext extension to file $PHP73CONFD/$php73ext.ini" + + printf "# configuration for php %s module\nextension=%s.so\n" "${php73ext_up}" "${php70ext}" >> "$INITMP" + cp_mv "$INITMP" "$PHP73CONFD/$php73ext.ini" + + need_restart=1 + else + + if ! grep -q "$php73ext_re" "$PHP73CONFD/$php73ext.ini"; then + + cp_echo "CN: Adding $php73ext extension to file $PHP73CONFD/$php73ext.ini" + + INITMP=`mktemp $PHP73CONFD/$php73ext.ini.tmp.XXXXXX` + cat "$PHP73CONFD/$php73ext.ini" > "$INITMP" + echo "extension=$php73ext.so" >> "$INITMP" + cp_mv "$INITMP" "$PHP73CONFD/$php73ext.ini" + + need_restart=1 + fi + fi + chmod 644 $PHP73CONFD/$php73ext.ini +done + + +# Enable some PHP7.3 tweaks for Apache2 web server (/etc/php/7.3/apache2/php.ini). +# +# * upload_max_filesize = 256M +# * post_max_size, memory_limit = depends on system memory, we are using +# phpmemlimit() function. +# * error_reporting = E_ERROR +# +for SAPI in apache2 cli; do + + if [ ! -d "$PHP73DIR/$SAPI" ]; then + continue + fi + + ini_file="$PHP73DIR/$SAPI/php.ini" + db_get php7.3-cn/${SAPI} || true + if [ "$RET" = "true" ]; then + + cp_echo "CN: Checking and enabling some specific parameters in file $ini_file" + + phplimit="$(phpmemlimit)M" + + if [ -f "$ini_file" ]; then + + cp_check_and_sed "^[[:space:]]*upload_max_filesize[[:space:]]*=" \ + '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:]]*=" \ + "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${phplimit}/" \ + "$ini_file" && need_restart=1 || true + + cp_check_and_sed "^[[:space:]]*memory_limit[[:space:]]*=" \ + "s/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = ${phplimit}/" \ + "$ini_file" && need_restart=1 || true + + cp_check_and_sed "^[[:space:]]*error_reporting[[:space:]]*=" \ + "s/^[[:space:]]*error_reporting[[:space:]]*=.*/error_reporting = E_ERROR/" \ + "$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[[:space:]]*=" $ini_file_tmp; then + echo "upload_max_filesize = 256M" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*post_max_size[[:space:]]*=" $ini_file_tmp; then + echo "post_max_size = ${phplimit}" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*memory_limit[[:space:]]*=" $ini_file_tmp; then + echo "memory_limit = ${phplimit}" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*error_reporting[[:space:]]*=" $ini_file_tmp; then + echo "error_reporting = E_ERROR" >> "$ini_file_tmp" + need_restart=1 + fi + cp_mv "$ini_file_tmp" "$ini_file" + chmod 644 "$ini_file" + + if [ -e "$ini_file_tmp" ]; then + rm -f "$ini_file_tmp" + fi + fi + + # Validate php.ini values. + if [ -f "$ini_file" ]; then + php73_inivalues="$(phpinivalidate "$ini_file")" + if [ -n "$php73_inivalues" ]; then + db_fset php7.3-cn/inivalues seen false + db_title php7.3-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.3-cn/inivalues php73_sapi $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.3-cn/inivalues ini_file "$ini_file" + db_capb escape + db_subst php7.3-cn/inivalues php73_inivalues "$(echo -n "$php73_inivalues" | debconf-escape -e)" + db_input critical php7.3-cn/inivalues || true + db_go || true + fi + fi +done + + +# Compare active PHP7.3 extensions with PHP7.0 ones, if PHP7.0 configuration still exists. +# +if [ -d "${PHP70DIR}" ] && [ -f "${PHP70DIR}/apache2/php.ini" ]; then + + phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}' + + # Get all active PHP7.0 extensions. + php70_ext="$(find ${PHP70DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + + # Get all active PHP7.3 extensions. + php73_ext="" + if [ -d "${PHP70DIR}" ]; then + php73_ext="$(find ${PHP73DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + fi + + # Compare PHP7.3 <-> PHP7.0 extensions. + php73_ext_mis="" + for ext in $php70_ext; do + if [ "$(echo $php73_ext | egrep $ext)" = "" ]; then + php73_ext_mis="\n${ext}${php73_ext_mis}" + fi + done + + # Some PHP7.3 extensions are not active. + if [ -n "$php73_ext_mis" ]; then + db_fset php7.3-cn/extensions seen false + db_title php7.3-cn - konfiguracija + db_capb escape + db_subst php7.3-cn/extensions php70_extensions "${php73_ext_mis#*\n}" + db_input critical php7.3-cn/extensions || true + db_go || true + fi +fi + + +db_stop || true + + +# Restart Apache2 web server if needed. +# +if [ $need_restart -eq 1 ]; then + + # Check Apache2 web server configuration. + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + 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" + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..b7ec504 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..953c4fe --- /dev/null +++ b/debian/templates @@ -0,0 +1,84 @@ +Template: php7.3-cn/apache2 +Type: boolean +_Description: Zelite li aktivirati preporucene PHP7.3 postavke za Apache2? + Provjerom trenutne PHP7.3 konfiguracije za Apache2 (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da su sljedece postavke aktivne: + . + upload_max_filesize = ${upload_max_filesize} + post_max_size = ${post_max_size} + memory_limit = ${memory_limit} + error_reporting = ${error_reporting} + . + Preporucamo sljedece: + . + upload_max_filesize = 256M + post_max_size = ${new_phplimit} + memory_limit = ${new_phplimit} + error_reporting = ${new_error_reporting} + +Template: php7.3-cn/cli +Type: boolean +_Description: Zelite li aktivirati preporucene PHP7.3 postavke za CLI? + Provjerom trenutne PHP7.3 konfiguracije za CLI (PHP interpreter + za komandnu liniju, konfiguracijska datoteka ${ini_file}), + ustanovljeno je da su sljedece postavke aktivne: + . + upload_max_filesize = ${upload_max_filesize} + post_max_size = ${post_max_size} + memory_limit = ${memory_limit} + error_reporting = ${error_reporting} + . + Preporucamo sljedece: + . + upload_max_filesize = 256M + post_max_size = ${new_phplimit} + memory_limit = ${new_phplimit} + error_reporting = ${new_error_reporting} + +Template: php7.3-cn/inivalues +Type: note +_Description: Postavke unutar PHP7.3 konfiguracije nisu ispravne + Provjerom trenutne PHP7 konfiguracije za ${php73_sapi} (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne: + . + ${php73_inivalues} + . + Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene + oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako provjerite postavke + unutar navedene datoteke kako bi aplikacije (kao sto je Squirrelmail) mogle + normalno funkcionirati. + +Template: php7.3-cn/extensions +Type: note +_Description: Neki dodaci (extensions) za PHP7.3 nisu ukljuceni + Iako je PHP7.0 uklonjen sa sustava, ostala je njegova konfiguracija. Usporedbom + trenutnih PHP7.0 i PHP7.3 konfiguracijskih datoteka, ustanovljeno je da sljedeci + PHP7.3 dodaci (extensions) nisu ukljuceni, iako su ukljuceni za PHP7.0: + . + ${php73_extensions} + . + Kako su neki od dodataka ukljuceni u PHP7.0 konfiguraciji, postoji mogucnost da + pojedine aplikacije zahtjevaju odgovarajuce dodatke za PHP7.3. Primjerice, ako + je u PHP7.0 konfiguraciji bio ukljucen dodatak za LDAP (php7.0-ldap), tada je + u PHP7.3 konfiguraciji potrebno ukljuciti PHP7.3 dodatak za LDAP (php7.3-ldap). Molimo, + svakako provjerite PHP7.3 postavke kako bi PHP aplikacije koje se koriste na + posluzitelju mogle normalno funkcionirati. + . + Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP7.3 + ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno + ignorirajte ovu poruku. + +Template: php7.3-cn/userdir +Type: note +_Description: PHP7.3 nije omogucen za neke direktorije + Provjerom trenutne PHP7.3 konfiguracije za Apache2 (konfiguracijska + datoteka ${php73_conf}), ustanovljeno je da PHP7.3 nije omogucen za neke + direktorije. + . + Molimo, svakako provjerite postavke unutar navedene konfiguracijske + datoteke. Ako ste sigurni da je ovakva konfiguracija ispravna, slobodno + ignorirajte ovu poruku. + . + Zbog sigurnosnih razloga, paket libapache2-mod-php7.3 onemogucuje PHP7.3 za + ~/public_html direktorije ako je omogucen mod_userdir modul za Apache2. -- 1.7.10.4