Package: carnet-upgrade
Architecture: all
-Depends: dialog, ${misc:Depends}
+Depends: dialog, wget, ${misc:Depends}
Description: CARNet distribution upgrade script
This package provides cn-upgrade, a helper script
to facilitate upgrades between different versions
# Full upgrade
true first_warning
+true check_my_version
true check_apache_version
true check_upgrade
true check_grsec_kernel
# last update: 2005-01-07
# Zoran 'jelly' Dzelajlija <jelly@srce.hr>
# Ivan 'ico' Rako <irako@srce.hr>
-version="carnet-upgrade v4.0.6"
+version="4.0.6"
# restart upgrade under script for logging purposes
if [ "$1" == "--no-script" ]; then
. ${ROOT}${cnup}/messages.sh
. ${ROOT}${cnup}/functions.sh
-log "$version starting"
+log "carnet-upgrade v$version starting"
main_queuetab="${cnup}/actions/main.queue"
post_upgrade_queuetab="/var/lib/carnet-upgrade/post_upgrade.queue"
xinetd-cn 2:2.3.13-1
'
+# URL to use for checking the latest version of carnet-upgrade itself
+packages_uri='ftp://ftp.carnet.hr/carnet-debian/dists/carnet-sarge/main/binary-all/Packages'
+
# Packages to forcibly install before installing the rest with dist-upgrade,
# because dist-upgrade would rather remove or keep them back them.
packages_first='
# funkcija za ispis paketa koje treba upgradeati
check_upgrade () {
local upgrade
- upgrade="`what_upgrade`"
+ upgrade=${1:-"`what_upgrade`"}
if [ "$upgrade" ]; then
notice "
fi
}
+# try to check if we are using the latest version of carnet-upgrade script
+check_my_version () {
+ local packages latest_version
+
+ packages=$(mktemp /var/lib/carnet-upgrade/Packages.XXXXXX)
+ if wget -q -O$packages $packages_uri; then
+ latest_version=$(sed -ne \
+ '/Package: carnet-upgrade/,/Description:/{ /Version: /s///p }' \
+ $packages)
+ rm -f $packages
+
+ if [ "$latest_version" ]; then
+ log "Running carnet-upgrade version is $version"
+ log "Latest carnet-upgrade version is $latest_version"
+ if dpkg --compare-versions "$version" lt "$latest_version"; then
+ check_upgrade " carnet-upgrade"
+ else log "Already using the latest carnet-upgrade version."; fi
+ else log "Failed to get latest version, skipping check."; fi
+ else log "Failed to download Packages file, skipping check."; fi
+
+ rm -f $packages
+}
+
# if apache is installed make sure it's version 2
check_apache_version () {