X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=5554f5de340d0439e4bdd34d70978f250f2f14fe;hb=11cfc731345934540f3af0e2ff47534baadaef1e;hp=af35ec59ac29ce2533b7b055954ab2b0ad769281;hpb=d443845d6ce091d56ff5e8b56c7d54511e5a268c;p=php5-cn.git diff --git a/debian/postinst b/debian/postinst index af35ec5..5554f5d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -31,6 +31,7 @@ A2MODEDIR="/etc/apache2/mods-enabled" EXTENSIONS="mysql" PHP5DIR="/etc/php5" PHP5CONFD="/etc/php5/conf.d" +PHP4DIR="/etc/php4" need_restart=0 @@ -136,7 +137,9 @@ for php5ext in $EXTENSIONS; do if [ -f "$ini_file" ]; then - cp_echo "CN: Removing $php5ext extension from file $ini_file" + if egrep -q "$php5ext_re" "$ini_file"; then + cp_echo "CN: Removing $php5ext extension from file $ini_file" + fi cp_check_and_sed "$php5ext_re" \ "/$php5ext_re/d" \ @@ -253,6 +256,45 @@ for SAPI in apache2 cli; do done +# Compare active PHP5 extensions with PHP4 ones, if PHP4 configuration still exists. +# +if [ -d "${PHP4DIR}" ] && [ -f "${PHP4DIR}/apache2/php.ini" ]; then + + phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}' + + # Get all active PHP4 extensions. + php4_ext="$(find ${PHP4DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + + # Get all active PHP5 extensions. + php5_ext="" + if [ -d "${PHP5DIR}" ]; then + php5_ext="$(find ${PHP5DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + fi + + # Compare PHP5 <-> PHP4 extensions. + php5_ext_mis="" + for ext in $php4_ext; do + if [ "$(echo $php5_ext | egrep $ext)" = "" ]; then + php5_ext_mis="\n${ext}${php5_ext_mis}" + fi + done + + # Some PHP5 extensions are not active. + if [ -n "$php5_ext_mis" ]; then + db_fset php5-cn/extensions seen false + db_title php5-cn - konfiguracija + db_capb escape + db_subst php5-cn/extensions php5_extensions "${php5_ext_mis#*\n}" + db_input critical php5-cn/extensions || true + db_go || true + fi +fi + + db_stop || true