Cross-Compiled Linux From Scratch - Version GIT-20170803-Sparc64-Multilib

Chapter 14. The End

14.2. Download Client

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

Some suggested clients include:

  • Curl http://cblfs.clfs.org/index.php/Curl

  • Inetutils http://cblfs.clfs.org/index.php/Inetutils

  • LFTP http://lftp.yar.ru/

  • Links http://cblfs.clfs.org/index.php/Links

  • Lynx http://cblfs.clfs.org/index.php/Lynx

  • NcFTP Client http://cblfs.clfs.org/index.php/Ncftp

  • Wget http://cblfs.clfs.org/index.php/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 http://www.bioinfo-user.org.uk/dokuwiki/doku.php/projects/wgetpl for wgetpl.

AltStyle によって変換されたページ (->オリジナル) /