}
remove_bloat() {
- local to_remove add_this i j n text to_show cmd tmpfile installed
+ local to_remove add_this i j text to_show cmd tmpfile installed
local update_selections pkgs_to_deselect oldifs
text="$msg_remove_bloat"
[ "$DEBUG" ] && set -x
n=0
+ pkglist=$(mktemp /var/lib/carnet-upgrade/pkglist.XXXXXX)
+ COLUMNS=200 dpkg -l | awk '$1 ~ /^.i/ { print $2 }' > $pkglist
for i in $(echo "$bloats" | sed 's/ */ /g'| awk -F' ' '{print $2}')
do
- if pkg $i; then
+ if grep -q "^$i$" $pkglist; then
installed="$installed $i"
add_this="$(echo "$bloats" | egrep " .*\b${i}\b" | sed 's/ */ /g'| awk -F' ' '{print $1}')"
if ! echo "$to_show" | grep -q "$add_this"; then
fi
fi
done
+ [ "$DEBUG" ] || rm -f $pkglist
[ -z "$to_show" ] && return 0
+ test $n -gt 8 && n=8
tmpfile=$(mktemp /var/lib/carnet-upgrade/dialog-tmp.XXXXXX)
cmd="dialog --nocancel --backtitle \""$title"\" --checklist \""$text"\" 20 75 $n $to_show"
[ "$DEBUG" ] && set +x
# if apache is installed make sure it's version 2
check_apache_version () {
- if ! pkg apache2-cn && pkg apache-cn; then
+ if pkg apache-cn && ! pkg apache2-cn; then
notice "
-Prije prelaska na Debian Etch potrebno je napraviti nadogradnju sa apache 1.3
-na apache 2.0.
+Prije prelaska na Debian Etch potrebno je napraviti nadogradnju sa apache 1.3 na apache 2.0.
Pokrenite:
'apt-get install apache2-cn'
restore_configs () {
pkg base-files lt 4 && restore_config /etc/issue /etc/issue.net
pkg bind9 lt 1:9.3.4 && restore_config /etc/bind/named.conf.options
- pkg dovecot-common lt 1.0 && restore_config /etc/dovecot/dovecot.conf
pkg libpam-modules lt 0.79 && restore_config /etc/security/limits.conf
pkg login lt 1:4.0.18.1 && restore_config /etc/pam.d/login
pkg mysql-server lt 5.0.3 && restore_config /etc/init.d/mysql \
rm -vf "$file"
done
fi
+
+ # register cn changes in ucf managed files
+ for config in /etc/apache/modules.conf \
+ /etc/clamav/clamd.conf \
+ /etc/clamav/freshclam.conf \
+ /etc/php4/apache2/php.ini \
+ /etc/php4/apache/php.ini \
+ /etc/php4/cgi/php.ini \
+ /etc/php4/cli/php.ini
+ do
+ config_backup=$config.$backup_ext
+ if [ -e $config -a ! -e $config_backup ]; then
+ cp -av $config $config_backup
+ ucf $config_backup $config
+ fi
+ done
}
# temporary disable listchanges packages to reduce clutter during upgrade
eval apt-get --yes remove $delpkg
fi
- # register cn changes in apache files
- for config in /etc/php4/cgi/php.ini \
- /etc/php4/cli/php.ini \
- /etc/php4/apache/php.ini \
- /etc/php4/apache2/php.ini \
- /etc/apache/modules.conf
- do
- config_backup=$config.$backup_ext
- if [ ! -e $config_backup ]; then
- cp -av $config $config_backup
- ucf $config_backup $config
- fi
- done
-
# remove old apache
pkgrm apache apache-common
dpkg --configure -a # try postinst again
}
+get_variable () {
+ name=$1
+ file=$2
+
+ if [ -f "$file" ]; then
+ val=$(sed -n "/^[[:space:]]*$name[[:space:]]*=/s/[[:space:]]*//gp" $file)
+ val=${val#*=}
+ fi
+
+ echo $val
+}
+
+# preserve mail location on upgrade
+upgrade_dovecot () {
+ local default_mail_env mail_location
+
+ # check if already upgraded
+ if ! pkg dovecot-common lt 1.0; then
+ return
+ fi
+
+ # save old mail location
+ default_mail_env=$(get_variable default_mail_env /etc/dovecot/dovecot.conf)
+
+ # silently upgrade package
+ restore_config /etc/dovecot/dovecot.conf
+ pkgadd dovecot-cn
+
+ # insert old mail location
+ mail_location=$(get_variable mail_location /etc/dovecot/dovecot.conf)
+ if [ "$default_mail_env" -a ! "$mail_location" ]; then
+ check_and_sed '^#mail_location[[:space:]]*=' \
+ "s|#mail_location[[:space:]]*=.*|mail_location = $default_mail_env|" /etc/dovecot/dovecot.conf || return 0
+
+ if [ -x /etc/init.d/dovecot ]; then
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ /usr/sbin/invoke-rc.d dovecot restart
+ else
+ /etc/init.d/dovecot restart
+ fi
+ fi
+ fi
+}
+
# fix /etc/dpkg/dpkg.cfg
comment_force_overwrite () {
if [ -f /etc/dpkg/dpkg.cfg ]; then