X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Ffunctions.sh;h=66021e4d209a6fd2c4714649cd56f705ea5b9011;hb=74f6d9e07d16ad6c7b17164a71c2db0a7405fdf7;hp=6f85840ef4085107bfcc659bac3aa79ec6ea257b;hpb=50191049f5c1d7b823bc4a018e989bdd6596d0ed;p=carnet-upgrade.git diff --git a/src/functions.sh b/src/functions.sh index 6f85840..66021e4 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -323,6 +323,38 @@ 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 + + # update the database + apt_update + 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