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.
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`
[ -x /etc/init.d/freeradius ] && /etc/init.d/freeradius start || true
else
log "slapd backup already at $ldap_backup, skipping."
- notice "Backup slapd baze u $ldap_backup vec postoji!"
+ #notice "Backup slapd baze u $ldap_backup vec postoji!"
fi
}
umask $old_umask
else
log "/etc backup already present in $etc_backup, skipping."
- notice "Backup /etc direktorija u $etc_backup vec postoji!"
+ #notice "Backup /etc direktorija u $etc_backup vec postoji!"
fi
}
restore_config kernel-2.6-cn libpam-modules 1.0.1-5 /etc/security/limits.conf
restore_config samba-cn samba-common 2:3.2.5-4lenny2 /etc/samba/smb.conf
restore_config '' base-files 5lenny2 /etc/issue /etc/issue.net
+ restore_config php5-cn php5-cli 5.2.6.dfsg.1-1+lenny2 /etc/php5/cli/php.ini
+ restore_config php5-cn libapache2-mod-php5 5.2.6.dfsg.1-1+lenny2 /etc/php5/apache2/php.ini
# check if monitrc is template based
if [ -f /etc/monit/monitrc -a ! -f /etc/monit/monitrc.$backup_ext ]; then
# remove unsupported php version
remove_php4 () {
# leave the configuration just in case
- pkgrm_only php4-common
+ pkgrm_only php4-common || true
}
# check if package is orphaned (nothing depends on it)
DEBIAN_FRONTEND=noninteractive pkgadd libc6 tzdata
}
-# upgrade apache2 to etch
+# upgrade apache2 to lenny
upgrade_apache2 () {
local package packages
for package in \
- libapache2-mod-php4 \
- php4-cli \
- php4-cgi \
- php4-cn \
+ libapache2-mod-php5 \
+ php5-cli \
+ php5-cn \
apache2-cn \
- php4-odbc \
- php4-suhosin \
+ php5-odbc \
+ php5-suhosin \
php-suhosin-cn
do
if pkg $package; then
fi
done
- # enable suhosin downgrade to etch version
- if pkg php4-suhosin; then
- pkgrm php4-suhosin php-suhosin-cn
- fi
-
eval pkgadd $packages
}
# handle freerdius config files upgrade
upgrade_freeradius () {
- local template config_new password realm
+ local template config_new password realm hostname basedn
pkg freeradius-aai lt 2.1.3-0lenny0 || return 0
restore_config freeradius-aai freeradius 2.1.3-0lenny0 \
/etc/freeradius/clients.conf \
/etc/freeradius/hints \
- /etc/freeradius/ldap.attrmap \
- /etc/freeradius/radiusd.conf
+ /etc/freeradius/ldap.attrmap
# handle template based configs
+ template=/usr/share/carnet-upgrade/files/etc/freeradius/radiusd.conf.template
+ config_new=$(mktemp /var/lib/carnet-upgrade/radiusd.conf.XXXXXX)
+ basedn=$(sed -n '/^[[:space:]]*suffix[[:space:]]*/ {
+ s///; s/"//g; p; q }' /etc/ldap/slapd.conf)
+ hostname=$(hostname -f)
+ cp $template $config_new
+ sed -i "s/#HOSTNAME#/$hostname/" $config_new
+ sed -i "s/#BASEDN#/$basedn/" $config_new
+ if cmp -s $config_new /etc/freeradius/radiusd.conf >/dev/null; then
+ log "Restoring config file /etc/freeradius/radiusd.conf"
+ cp -v /usr/share/carnet-upgrade/files/etc/freeradius/radiusd.conf.restore \
+ /etc/freeradius/radiusd.conf
+ fi
+ rm -f $config_new
+
template=/usr/share/carnet-upgrade/files/etc/freeradius/eap.conf.template
config_new=$(mktemp /var/lib/carnet-upgrade/eap.conf.XXXXXX)
password=$(grep -s '^[[:space:]]*private_key_password[[:space:]]*=' \
# upgrade the MTA
upgrade_postfix () {
- pkgadd postfix-cn
+ pkgadd sasl2-bin postfix-cn
if pkg postgrey; then
pkgrm postgrey # not used by postfix-cn anymore