# Download Client

The final system build does not install an FTP or HTTP client for downloading files.

Some suggested clients include:

- Curl

- Inetutils

- LFTP

- Links

- Lynx

- NcFTP Client

- Wget

- BASH - A user can use net redirections (if not disabled when building bash in the final system) to download wget or another program.

      cat > download.sh << "EOF"
      #!/bin/bash

      WGET_VERSION='1.14'
      WGET_HOSTNAME='ftp.gnu.org'
      exec {HTTP_FD}<>/dev/tcp/${WGET_HOSTNAME}/80
      echo -ne "GET /gnu/wget/wget-${WGET_VERSION}.tar.xz HTTP/1.1\r\nHost: "\
          ${WGET_HOSTNAME}'\r\nUser-Agent: '\
          'bash/'${BASH_VERSION}'\r\n\r\n'  >&${HTTP_FD}
      sed -e '1,/^.$/d' <&${HTTP_FD} >wget-${WGET_VERSION}.tar.xz
      EOF

- GAWK

      cat > gawkdl.sh << "EOF"
      #!/bin/bash

      gawk 'BEGIN {
        NetService = "/inet/tcp/0/mirror.anl.gov/80"
        print "GET /pub/gnu/wget/wget-1.14.tar.xz" |& NetService
        while ((NetService |& getline) > 0)
          print $0
        close(NetService)
      }' > binary

      gawk '{q=p;p=$0}NR>1{print q}END{ORS = ""; print p}' binary > wget-1.14.tar.xz

      rm binary
      EOF

- PERL with HTTP::Tiny (Included with final system PERL install).

      cat > download.pl << "EOF"
      #!/usr/bin/perl

      use HTTP::Tiny;
      my $http = HTTP::Tiny->new;
      my $response;

      $response = $http->mirror('http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz', 'wget-1.14.tar.xz');
      die "Failed!\n" unless $response->{success};
      print "Unchanged!\n" if $response->{status} eq '304';
      EOF

  Or use this:

      perl -MHTTP::Tiny -E 'say HTTP::Tiny->new->get(shift)->{content}' "http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz" > binary
      perl -e 'local $/; $_ = <>; s/\n$//; print' binary > wget-1.14.tar.xz
      rm binary

- PERL with LWP: Run `cpan` and manually configure the client. Run `install LWP` while in the CPAN shell.

  Refer to for wgetpl.