From 3d86bafffc213b905aa72dfcaba045d22997e7c2 Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Tue, 28 Apr 2009 12:35:03 +0200 Subject: [PATCH] Install compatible php5 extensions. --- src/functions.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/functions.sh b/src/functions.sh index 175d263..7511bc2 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -451,6 +451,9 @@ check_my_version () { check_php_version () { if pkg php4-cn && ! pkg php5-cn; then + # prepare for php upgrade by installing php5 extensions + install_php5_extensions + notice " Prije prelaska na Debian Lenny potrebno je napraviti nadogradnju sa PHP 4 na PHP 5. @@ -464,6 +467,33 @@ Nakon sto provjerite da sve web aplikacije rade ispravno, ponovno pozovite ovu s fi } +# install php5 extensions based on installed php4 extensions +install_php5_extensions () { + local php4_list php5_pkg + + # get a list of installed php4 packages + php4_list=$(mktemp /var/lib/carnet-upgrade/php4_list.XXXXXX) + dpkg -l php4-\* | awk '/^ii/ { + pkg=$2; sub("^php4", "php5", pkg); print pkg }' > $php4_list + + # compare it with the list of available php5 packages + php5_pkg=$(apt-cache search -n ^php5- | cut -d' ' -f 1 \ + | grep -F -x -f $php4_list | grep -F -x -v php5-cn) + + # handle special cases + if pkg php4-xslt; then + php5_pkg="$php5_pkg php5-xsl" + fi + + # install the required php5 modules + if [ "$php5_pkg" ]; then + pkgadd $php5_pkg + fi + + # cleanup + rm -f $php4_list +} + # if grsec is installed make sure it is fresh check_grsec_kernel () { local ver=`uname -r` -- 1.7.10.4