[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Make debootstrap re-entrant?



On Thu, Nov 01, 2001 at 07:47:57AM -0700, Chris Tillman wrote:
> It can't think of any reason not to make debootstrap's downloading of debs
> more friendly. I had my base install interrupted tonight and I had to wait
> through all the same downloads again, although they were already there on
> the disk.

this is annoying, but not as trivial to fix as you may think.

debootstrap already retries failed downloads three times which should
reduce the liklyhood of fatal interruptions.

> I was getting an average of 22kb/sec on my DSL connection, so it only set me
> back a half hour or so. For those trying to install over a modem connection,
> it would be very frustrating when the connection gets interrupted to have to
> restart from the beginning.

tell me about it.

> I have no experience with shell code, but this looked like it might do the
> trick:
> 
> --- functions.orig	Wed Oct 31 23:52:04 2001
> +++ functions	Thu Nov  1 00:27:30 2001
> @@ -161,6 +161,7 @@
>      error 1 "${from#null:} was not pre-downloaded"
>    elif [ "${from#http://}"; != "$from" -o "${from#ftp://}"; != "$from" ]; then
>      # http/ftp mirror
> +    if [ -e $dest ]; then return 0; fi 
>      if wgetprogress -O "$dest" "$from"; then
>        return 0
>      elif [ -s "$dest" ]; then
> 
> I'm fairly certain that the file doesn't exist for -e until it's been fully
> downloaded and closed. So I don't believe there would be any risk of ending

not true, do repeated ls -l of /target/var/cache/apt/archives/ while
debootstrap is running and you will see this is not correct.

> up with an half-completed file. The checksum could be checked, if there is.

there is a very great risk of a half downloaded file, the very moment
wget is started there is a zero length .deb with the filename your
looking for, then it slowly grows until its complete, if something
goes wrong you end up with a partitial file, debootstrap should retry
the download rerunning wget with -c which tells it to use the partial
file already there and resume where it left off.

with your patch debootstrap will fool itself into thinking the file is
downloaded and then the base install with puke horribily with gzip, ar
and tar failing miserably on the corrupt archive.

we could probably add in addition to this check, do an md5sum check to see
if the .deb is valid, and if so leave it, otherwise resume the
download.  ill look into this, im currently working on fixing the
defective progress bar stuffs. 

-- 
Ethan Benson
http://www.alaska.net/~erbenson/

Attachment: pgpsmTFdTomHx.pgp
Description: PGP signature


Reply to: