tag 613910 + patch thanks On Fri, 2011-02-18 at 08:28 +0000, Adam D. Barratt wrote: > Thanks very much for including my rather last minute apt-setup patch to > add $codename-updates to sources.list when volatile is selected for >= > squeeze installs. > > Unfortunately, the behaviour is somewhat suboptimal when an install is > performed using no network mirror, leading to malformed sources.list > entries as the relevant debconf entries are unset and there isn't a > default HTTP / FTP mirror entry to fall back on.
Attached is a patch which aims to remedy (or at least significantly improve) the behaviour mentioned above. If a network mirror was not selected during install, commented entries are added to the target sources.list for $codename-updates, pointing at ftp.debian.org and including an explanation of why the entries are commented out and that the mirror in use should be adjusted as appropriate for the system if the entry is enabled. This means that the entries added to sources.list are always syntactically valid and are likely to work if uncommented, and avoids the ugly error message presented to users. There is still the issue that users installing in such a manner and requesting "volatile" will not get an enabled sources.list entry but I think this is acceptable; if it's not then the ftp.d.o entry could be inserted without being commented out. The explanatory comments are also non-translat{ed,able} but imho that's preferable to them not existing; they're easy to remove if you'd rather they not be included. Regards, Adam
diff -Nru apt-setup-0.53/debian/changelog apt-setup-0.53+squeeze1/debian/changelog --- apt-setup-0.53/debian/changelog 2011-01-16 18:50:09.000000000 +0000 +++ apt-setup-0.53+squeeze1/debian/changelog 2011-02-25 16:11:49.000000000 +0000 @@ -1,3 +1,14 @@ +apt-setup (1:0.53+squeeze1) stable; urgency=low + + * If no network mirror was selected during install, add a (commented-out) + entry pointing at ftp.debian.org, together with a comment explaining why + the entry is commented out and that it should be updated to use a relevant + mirror. The comment is not translated, but this is still preferable to + the previous behaviour of creating clearly broken entries under such + circumstances which users then re-enabled. (Closes: #613910) + + -- Adam D. Barratt <a...@adam-barratt.org.uk> Fri, 25 Feb 2011 16:04:21 +0000 + apt-setup (1:0.53) unstable; urgency=low * Support cd_type "bluray". In particular, don't prompt at high priority diff -Nru apt-setup-0.53/generators/92volatile apt-setup-0.53+squeeze1/generators/92volatile --- apt-setup-0.53/generators/92volatile 2010-12-07 21:22:43.000000000 +0000 +++ apt-setup-0.53+squeeze1/generators/92volatile 2011-02-25 19:02:33.000000000 +0000 @@ -47,7 +47,17 @@ if [ "$codename" = "lenny" ]; then echo "deb http://$host/debian-volatile $codename/volatile $dists" >> $file else - echo "deb $protocol://${host}${directory} ${codename}-updates $dists" >> $file + echo "# ${codename}-updates, previously known as 'volatile'" >> $file + + if [ -n "$protocol" ] && [ -n "$host" ]; then + echo "deb $protocol://${host}${directory} ${codename}-updates $dists" >> $file + else + echo "# A network mirror was not selected during install. The following entries" >> $file + echo "# are provided as examples, but you should amend them as appropriate" >> $file + echo "# for your mirror of choice." >> $file + echo "#" >> $file + echo "# deb http://ftp.debian.org/debian/ ${codename}-updates $dists" >> $file + fi fi if db_get netcfg/dhcp_options && \ [ "$RET" = "Do not configure the network at this time" ]; then @@ -68,7 +78,11 @@ if [ "$codename" = "lenny" ]; then echo "deb-src http://$host/debian-volatile $codename/volatile $dists" >> $file else - echo "deb-src $protocol://${host}${directory} ${codename}-updates $dists" >> $file + if [ -n "$protocol" ] && [ -n "$host" ]; then + echo "deb-src $protocol://${host}${directory} ${codename}-updates $dists" >> $file + else + echo "# deb-src http://ftp.debian.org/debian/ ${codename}-updates $dists" >> $file + fi fi exit $CODE