if [ "$upgrade" ]; then
notice "
-Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju ovih paketa:
+Prije prelaska na Debian stretch potrebno je napraviti nadogradnju ovih paketa:
$upgrade
Pokrenite:
# backup old version
if [ -f $sl -a ! -f $sl.$backup_ext ]; then
- cp -av $sl $sl.$backup_ext
+ cp -v $sl $sl.$backup_ext
fi
# install new version
- cp -av $sl_new $sl
+ cp -v $sl_new $sl
notice "Novi sadrzaj datoteke /etc/apt/sources.list:
`cat /etc/apt/sources.list`"
fi
+ # make sure permissions are correct
+ chmod 0644 $sl
rm $sl_new
}
fi
}
+# load various debconf defaults
+debconf_preload () {
+ echo libc6 libraries/restart-without-asking boolean true | debconf-set-selections
+}
+
# temporary disable listchanges packages to reduce clutter during upgrade
apt_listchanges () {
local file command=$1
fi
}
-# make a silent upgrade to new libc6
-upgrade_libc () {
- DEBIAN_FRONTEND=noninteractive pkgupgrade libc6 libc6-dev tzdata
-}
-
# upgrade apache2/php5
upgrade_apache2 () {
pkgrm apache-common # prevents installation of apache2-suexec
- pkgrm php5-suhosin # not available for wheezy
pkgupgrade libapache2-mod-php5 php5-cli php5-cn apache2-cn \
- php5-odbc
+ php5-odbc mod-security-cn
}
upgrade_amavis () {
fi
done
+ # workaround for insserv complaining
+ if [ -x /sbin/insserv ]; then
+ if [ -r /etc/init.d/amavis.amavisd-new ]; then
+ /sbin/insserv amavis.amavisd-new
+ fi
+ fi
+
# install new packages
pkgadd amavisd-cn amavisd-new
- # start new packages
- /etc/init.d/amavisd-cn restart
-}
-
-# handle freerdius upgrade
-upgrade_freeradius () {
- local password
-
- pkg freeradius-aai lt 2.1.12~srce1 || return 0
-
- # aai team prevents a normal upgrade
- cp -av /etc/freeradius /etc/freeradius.$backup_ext
- 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\(:[[:digit:]]\+\)\?[[:space:]]\+$password[[:space:]]\+" \
- /etc/pam_radius_auth.conf
- then
- sed -i.$backup_ext "s/^\(127.0.0.1\(:[[:digit:]]\+\)\?[[:space:]]\+\)[^[:space:]]\+\(.*\)/\1$password\3/" /etc/pam_radius_auth.conf
+ # workaround for insserv complaining
+ if [ -x /sbin/insserv ]; then
+ if [ -r /etc/init.d/amavis.amavisd-new ]; then
+ /sbin/insserv amavis.amavisd-new
fi
fi
+
+ # start new packages
+ ### By zelja, nema vise amavisd-cn, vjerujemo systemd-u
+ ### /etc/init.d/amavisd-cn restart
+ /etc/init.d/amavis restart
}
# handle mysql 5.0 to 5.1 upgrade
# upgrade the IMAP server
upgrade_dovecot() {
- if [ ! -f /etc/dovecot/conf.d/95-local ]; then
+ local local_conf=/etc/dovecot/conf.d/95-${backup_ext}.conf
+
+ if [ -f /etc/dovecot/conf.d/95-local -a ! -f $local_conf ]; then
+ mv /etc/dovecot/conf.d/95-local $local_conf
+ sed -i 's/\/usr\/lib\/dovecot\/modules\/imap/\/usr\/lib\/dovecot\/modules/g' $local_conf
+ /etc/init.d/dovecot restart
+ fi
+
+ if [ ! -f $local_conf ]; then
pkgrm dovecot-cn
# restore config
# install new version and restore local changes
pkgadd dovecot-core
- doveconf -n -c /etc/dovecot/dovecot.conf.$backup_ext > /etc/dovecot/conf.d/95-local
+ doveconf -n -c /etc/dovecot/dovecot.conf.$backup_ext > $local_conf
+ sed -i 's/\/user\/lib\/dovecot\/modules\/imap/\/usr\/lib\/dovecot\/modules/g' $local_conf
pkgadd dovecot-cn
fi
fi
}
+# manual upgrade of mailman to avoid two copies of mailman running
+# first started by python upgrade and second started by mailman itself
+upgrade_mailman() {
+ if pkg mailman-cn lt 2:2.1.15~cn0; then
+ /etc/init.d/mailman stop || true
+ pkgadd python
+ pkgadd mailman mailman-cn
+ fi
+}
+
+# manual upgrade of kernel due to new packet name
+upgrade_kernel() {
+ if pkg kernel-2.6-cn; then
+ pkgrm kernel-2.6-cn
+
+ if pkg grub-pc; then
+ pkgadd kernel-cn grub-pc
+ else
+ pkgadd kernel-cn
+ fi
+ fi
+}
+
get_variable () {
local name=$1 file=$2 val
echo $val
}
+# switch to rsyslog
+upgrade_syslog() {
+ # libc6-dev prevents upgrade
+ if pkg libc6-dev; then
+ pkgrm libc6-dev
+ fi
+
+ pkgadd rsyslog
+ dpkg -P sysklogd klogd
+}
+
# restore munin configs for silent upgrade
upgrade_munin () {
local config backup hostname domain
dpkg-reconfigure munin-cn
}
-# try not to overwrite user modified issue files
-fix_issue () {
- 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
-
- 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() {
local available_disk_space archives_size
available_disk_space=$(free_space /var/cache/apt/archives/)
fi
}
-# calculate the list of linux-image packages from kernel-2.6-cn dependencies
+# calculate the list of linux-image packages from kernel-cn dependencies
get_cn_kernels() {
local cn_kernels linux_images metapkg pkg
cn_kernels=
- linux_images=$(apt-cache show kernel-2.6-cn | grep ^Depends: \
+ linux_images=$(apt-cache show kernel-cn | grep ^Depends: \
| grep -o 'linux-image[^, ]*')
for metapkg in $linux_images; do
pkg=$(apt-cache show $metapkg | grep ^Depends: \
log "Kernel package: $pkg"
log "Kernel size: ${kernel_size}MB"
- if LC_ALL=C apt-get -s install kernel-2.6-cn 2>/dev/null \
- | grep -q '^kernel-2.6-cn is already the newest version.$'
+ if LC_ALL=C apt-get -s install kernel-cn 2>/dev/null \
+ | grep -q '^kernel-cn is already the newest version.$'
then
- log "Not checking free space in /: kernel-2.6-cn already installed"
+ log "Not checking free space in /: kernel-cn already installed"
return
fi