fi
}
+# update sarge urls in sources list
+fix_sarge_sources () {
+ local apt_sources='/etc/apt/sources.list'
+ local fixed_sources=$(mktemp /var/lib/carnet-upgrade/sources.list.XXXXXX)
+
+ # sarge (oldstable) was archived recently -> sources.list needs update
+ awk -v archive='http://archive.debian.org/debian' \
+ -v security='http://archive.debian.org/debian-security' \
+ '$3 == "sarge" && $2 ~ /[/]debian$/ { $2 = archive }
+ $3 == "sarge/updates" && $2 ~ /security\.debian\.org$/ { $2 = security }
+ { print }' $apt_sources > $fixed_sources
+
+ # did anything get updated
+ if ! cmp $apt_sources $fixed_sources >/dev/null; then
+ log "sources.list fixed to use archive.debian.org"
+
+ # backup current version
+ if [ ! -f "$apt_sources.$backup_ext.sarge" ]; then
+ cp -av $apt_sources "$apt_sources.$backup_ext.sarge"
+ fi
+
+ # install fixed version
+ cp -av $fixed_sources $apt_sources
+ fi
+
+ # delete temporary
+ rm -f $fixed_sources
+}
+
# try to check if we are using the latest version of carnet-upgrade script
check_my_version () {
local packages latest_version