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

Make debootstrap re-entrant?



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.

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.

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
up with an half-completed file. The checksum could be checked, if there is.

-- 
*----------------------------------------------------------------*
|  .''`.  |   Debian GNU/Linux: <http://www.debian.org>          |
| : :'  : |   debian-imac: <http://debian-imac.sourceforge.net>  |
| `. `'`  |      Chris Tillman        tillman@azstarnet.com      |
|   `-    |            May the Source be with you                |
*----------------------------------------------------------------*



Reply to: