[go: nahoru, domu]

Skip to content

Commit

Permalink
ubuntu/bootstrap: Use curl instead of wget
Browse files Browse the repository at this point in the history
Test:
 mv /usr/bin/wget /usr/bin/wget.out
 crouton -r xenial -t core
  • Loading branch information
drinkcat committed Nov 14, 2017
1 parent 35a1688 commit 11e084d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions installer/ubuntu/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
# Grab the latest release of debootstrap
echo 'Downloading latest debootstrap...' 1>&2
d='https://anonscm.debian.org/gitweb/?p=d-i/debootstrap.git;a=snapshot;h=HEAD;sf=tgz'
if ! wget -O- --no-verbose --timeout=60 -t2 "$d" \
if ! curl --connect-timeout 60 --retry 2 --output - "$d" \
| tar -C "$tmp" --strip-components=1 -zx 2>/dev/null; then
echo 'Download from Debian gitweb failed. Trying latest release...' 1>&2
d='http://httpredir.debian.org/debian/pool/main/d/debootstrap/'
d_api='https://sources.debian.net/api/src/debootstrap/'
f="$(wget -O- --no-verbose --timeout=60 -t2 "$d_api" \
f="$(curl --connect-timeout 60 --retry 2 --output - "$d_api" \
| sed -ne 's ^.*\"version\":\ \"\([0-9.]*\)\".*$ debootstrap_\1.tar.gz p' \
| sort -V | tail -n 1)"
if [ -z "$f" ]; then
Expand All @@ -26,7 +26,7 @@ Check your internet connection or proxy settings and try again.'
v="${f#*_}"
v="${v%.tar.gz}"
echo "Downloading debootstrap version $v..." 1>&2
if ! wget -O- --no-verbose --timeout=60 -t2 "$d$f" \
if ! curl --connect-timeout 60 --retry 2 --output - "$d$f" \
| tar -C "$tmp" --strip-components=1 -zx 2>/dev/null; then
error 1 'Failed to download debootstrap.'
fi
Expand Down Expand Up @@ -55,6 +55,11 @@ fi
# Patch debootstrap so that is does not create devices under /dev (issue #2387).
sed -i -e 's/^setup_devices () {$/\0 return 0/' "$tmp/functions"

# Patch debootstrap to use curl instead of wget
# Note that we do not translate other parameter, and lose the progress bar, but
# we do not use these anyway.
sed -i -e 's/wgetprogress\(.*\) -O "$dest"/curl\1 -o "$dest"/' "$tmp/functions"

# Add the necessary debootstrap executables
newpath="$PATH:$tmp"
cp "$INSTALLERDIR/$DISTRO/ar" "$INSTALLERDIR/$DISTRO/pkgdetails" "$tmp/"
Expand Down

0 comments on commit 11e084d

Please sign in to comment.