LC_MESSAGES=hr_HR dialog --backtitle "$title" --yesno "$msg_remove_x" 18 75
if [ $? -eq 0 ]; then
log "Removing X Window System"
- pkgrm xlibs
+ pkgrm x11-common
else
log "Skipping X Window System removal"
fi
if [ "$upgrade" ]; then
notice "
-Prije prelaska na Debian Lenny potrebno je napraviti nadogradnju ovih paketa:
+Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju ovih paketa:
$upgrade
Pokrenite:
install_php5_extensions
notice "
-Prije prelaska na Debian Lenny potrebno je napraviti nadogradnju sa PHP 4 na PHP 5.
+Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju sa PHP 4 na PHP 5.
Pokrenite:
# apt-get update
if [ "$ver" = "${ver#2.6.2[4-9]}" ]; then
# kernel too old
notice "
-Prije prelaska na Debian Lenny potrebno je napraviti nadogradnju na najnoviji kernel.
+Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju na najnoviji kernel.
Pokrenite:
# apt-get update
return 1
esac
- pkgadd_if_installed $packages
+ pkgupgrade $packages
+}
+
+# install packages introduced in this release
+install_new () {
+ if [ "$new_packages" ]; then
+ pkgadd $new_packages
+ fi
}
# funkcija utrpa ispravan sources.list
# make a silent installation of carnet and srce keyrings
install_keyrings () {
pkgadd carnet-keyring srce-keyring debian-archive-keyring
- pkgadd_if_installed dpkg apt debconf python-apt dpkg-dev
+ pkgupgrade dpkg apt debconf python-apt dpkg-dev
dpkg-reconfigure carnet-keyring srce-keyring debian-archive-keyring
apt_update
}
# only upgrade packages if they are already installed
-pkgadd_if_installed () {
+pkgupgrade () {
local packages
packages=$( grep_installed $* )
# make a silent upgrade to new libc6
upgrade_libc () {
- DEBIAN_FRONTEND=noninteractive pkgadd_if_installed libc6 libc6-dev tzdata
+ DEBIAN_FRONTEND=noninteractive pkgupgrade libc6 libc6-dev tzdata
}
-# upgrade apache2/php5 to lenny
+# upgrade apache2/php5
upgrade_apache2 () {
- pkgadd_if_installed libapache2-mod-php5 php5-cli php5-cn apache2-cn \
+ pkgrm apache-common # prevents installation of apache2-suexec
+ pkgupgrade libapache2-mod-php5 php5-cli php5-cn apache2-cn \
php5-odbc php5-suhosin php-suhosin-cn
}
/etc/init.d/amavis restart
}
-# handle freerdius config files upgrade
+# handle freerdius upgrade
upgrade_freeradius () {
local template config_new password realm hostname basedn
pkg freeradius-aai lt 2.1.3-0lenny0 || return 0
- # handle static configs
- restore_file /etc/freeradius/clients.conf
- restore_file /etc/freeradius/hints
- restore_file /etc/freeradius/ldap.attrmap
-
- # handle template based configs
- basedn=$(sed -n '/^[[:space:]]*suffix[[:space:]]*/ {
- s///; s/"//g; p; q }' /etc/ldap/slapd.conf)
- hostname=$(hostname -f)
- config_new=$(copy_template /etc/freeradius/radiusd.conf)
- sed -i "s/#HOSTNAME#/$hostname/" $config_new
- sed -i "s/#BASEDN#/$basedn/" $config_new
- restore_file /etc/freeradius/radiusd.conf $config_new
- rm -f $config_new
-
- password=$(grep -s '^[[:space:]]*private_key_password[[:space:]]*=' \
- /etc/freeradius/eap.conf)
- config_new=$(copy_template /etc/freeradius/eap.conf)
- sed -i "s/.*#PASSWORD#.*/$password/" $config_new
- restore_file /etc/freeradius/eap.conf $config_new
- rm -f $config_new
-
- realm=$(sed -n '/^[[:space:]]*suffix[[:space:]]*/ {
- s///; s/"//g; s/,dc=/./g; s/dc=//; s/.hr$//; p; q }' /etc/ldap/slapd.conf)
- config_new=$(copy_template /etc/freeradius/proxy.conf)
- sed -i "s/#REALM#/$realm/" $config_new
- restore_file /etc/freeradius/proxy.conf $config_new
- rm -f $config_new
-
- # install the new packages
- if ! apt-get -y install freeradius; then
- # freeradius upgrade fails here, try to fix it by creating certificates
- [ -x /etc/freeradius/certs/bootstrap ] && /etc/freeradius/certs/bootstrap
-
- dpkg --configure -a
- apt-get -y -f install
- fi
-
- # finally try to cleanup this mess
+ # aai team prevents a clean upgrade
+ cp -av /etc/freeradius /etc/freeradius.$backup_ext
+ pkgrm freeradius-aai freeradius-ldap freeradius
pkgadd freeradius-aai
}
fi
}
+# upgrade bind separately so DNS is not down for too long
+# or breaks postinst scripts of other cn packages that depend on
+# working resolver
+upgrade_bind() {
+ pkgadd bind9-cn
+}
+
get_variable () {
local name=$1 file=$2 val
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_file /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
-}
-
# restore munin configs for silent upgrade
upgrade_munin () {
local config backup hostname domain
fi
}
+# try not to overwrite user modified issue files
fix_issue () {
- cat > /etc/issue <<EOF
-Debian GNU/Linux 5.0 (CARNet Debian 5.0) \\n \\l
+ if cmp /etc/issue $cnup/files/etc/issue.expect.new >/dev/null; then
+ cp -av /etc/issue /etc/issue.$backup_ext
+ cat > /etc/issue <<EOF
+Debian GNU/Linux 6.0 (CARNet Debian 6.0) \\n \\l
EOF
+ fi
- cat > /etc/issue.net <<EOF
-Debian GNU/Linux 5.0 (CARNet Debian 5.0) %h
+ if cmp /etc/issue.net $cnup/files/etc/issue.net.expect.new >/dev/null; then
+ cp -av /etc/issue.net /etc/issue.net.$backup_ext
+ cat > /etc/issue.net <<EOF
+Debian GNU/Linux 6.0 (CARNet Debian 6.0) %h
EOF
+ fi
}
check_archives_space() {
}
check_kernel_space() {
- local available_disk_space kernel_size
+ local available_disk_space kernel_size linux_images pkg ret
available_disk_space=$(free_space /)
- kernel_size=$(installed_size kernel-2.6-cn)
+ linux_images=$(apt-cache show kernel-2.6-cn | grep ^Depends: \
+ | grep -o 'linux-image[^ ]*')
+ for pkg in $linux_images; do
+ kernel_size=$(installed_size $pkg)
+ ret=$?
+ [ $ret -eq 0 ] && break
+ done
- if [ $? -ne 0 ]; then
+ if [ $ret -ne 0 ]; then
log "Failed to get installed size, skipping check."
return 0
fi
log "Free space in /: ${available_disk_space}MB"
+ log "Kernel package: $pkg"
log "Kernel size: ${kernel_size}MB"
- if LC_ALL=C apt-get --yes --print-uris install kernel-2.6-cn \
+ if LC_ALL=C apt-get -s install kernel-2.6-cn \
| grep -q '^kernel-2.6-cn is already the newest version.$'
then
log "Not checking free space in /: kernel-2.6-cn already installed"
echo $num
}
+
+# make sure carnet-upgrade doesn't get upgraded until the end
+hold_carnet_upgrade() {
+ echo carnet-upgrade hold | dpkg --set-selections
+}
+
+release_carnet_upgrade() {
+ echo carnet-upgrade install | dpkg --set-selections
+}