From: Valentin Vidic Date: Wed, 5 Nov 2008 15:14:48 +0000 (+0100) Subject: Fix sarge sources.list to use archive.debian.org. X-Git-Tag: debian/4.0.7~4 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=8399eac47011395722b0fec41a51c69524843081;p=carnet-upgrade.git Fix sarge sources.list to use archive.debian.org. --- diff --git a/src/actions/main.queue b/src/actions/main.queue index d7b116f..3b93066 100644 --- a/src/actions/main.queue +++ b/src/actions/main.queue @@ -1,5 +1,6 @@ # Full upgrade true first_warning +true fix_sarge_sources true check_my_version true check_apache_version true check_upgrade diff --git a/src/functions.sh b/src/functions.sh index 6f85840..2399e2d 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -323,6 +323,35 @@ Nakon toga ponovno pozovite ovu skriptu." 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