}
}
+# remove stale package information from available
+# warning, in file '/var/lib/dpkg/available'
+# near line 58185 package 'vim-cn': missing architecture
+cleanup_available () {
+ log "Cleaning dpkg available file"
+
+ available=$(mktemp /var/lib/carnet-upgrade/available.XXXXXX)
+ apt-cache dumpavail > $available
+
+ dpkg --clear-avail
+ dpkg --update-avail $available
+
+ rm -f $available
+}
+
remove_x() {
LC_MESSAGES=hr_HR dialog --backtitle "$title" --yesno "$msg_remove_x" 18 75
if [ $? -eq 0 ]; then
log "Removing X Window System"
- pkgrm x11-common
+ pkgrm xserver-xorg
else
log "Skipping X Window System removal"
fi
case $command in
disable)
if [ -f $file ]; then
- dpkg-divert --local --rename --divert $file.$backup_ext \
+ dpkg-divert --local --rename --divert $file.disabled \
--add $file || true
fi
;;
enable)
- if [ -f $file.$backup_ext ]; then
- dpkg-divert --remove $file || true
- fi
+ # cleanup the diversion even if the file is already removed
+ dpkg-divert --rename --remove $file || true
;;
esac
done
# remove old and unused libraries
remove_orphaned () {
- local package
+ local package remove
apt_autoremove
+ remove=
for package in $orphaned_packages; do
if is_orphaned $package; then
- pkgrm $package
+ remove="$remove $package"
fi
done
+
+ if [ "$remove" ]; then
+ pkgrm $remove
+ fi
}
# monit it causing problems for postinst scripts
# handle freerdius upgrade
upgrade_freeradius () {
+ local password
+
pkg freeradius-aai lt 2.1.10-1 || return 0
# aai team prevents a normal upgrade
pkgrm freeradius-aai freeradius-ldap freeradius
rm -rf /etc/freeradius/certs
pkgadd freeradius-aai
+
+ # sync localhost passwords
+ if pkg libpam-radius-auth && [ -f "/etc/pam_radius_auth.conf" ]; then
+ pkgadd libpam-radius-auth
+ password=$(
+ sed -n '/^[[:space:]]*client[[:space:]]\+localhost/,/^[[:space:]]*}/ { /^[[:space:]]*secret[[:space:]]*=[[:space:]]*\([^[:space:]]*\)/s//\1/p }' /etc/freeradius/clients.conf
+ )
+ if [ "$password" ] \
+ && ! grep -q "^127.0.0.1[[:space:]]\+$password[[:space:]]\+" \
+ /etc/pam_radius_auth.conf
+ then
+ sed -i.$backup_ext "s/^\(127.0.0.1[[:space:]]*\)[^[:space:]]*\(.*\)/\1$password\2/" /etc/pam_radius_auth.conf
+ fi
+ fi
}
# handle mysql 5.0 to 5.1 upgrade