wgetコンテンツ構成UbuntuとAlpine

wgetコンテンツ構成UbuntuとAlpine

Ubuntuでは、次のwgetフラグを使用してDebianを取得できます。

wget --content-disposition https://packagecloud.io/xxxxx/download.deb
dpkg -i ...

Alpineでは、wgetは--content-disposition無効性について文句を言います。

wget: unrecognized option: content-disposition
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
        [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
        [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy

アルパインでは別の「wget」をダウンロードする必要がありますか?

ベストアンサー1

Alpine Linuxでは、多くの一般的なシェルツールがBusyBoxに置き換えられています。次のコマンドの出力を確認すると、wgetのケースがそれに該当することがわかります。

ls -lah $(which wget)

私の前にあるAlpineインストールでは、これはシンボリックリンクです。/bin/busybox

BusyBoxにはwgetオプションはありません--content-disposition

# wget --help
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
    [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
    [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

    --spider    Only check URL existence: $? is 0 if exists
    -c      Continue retrieval of aborted transfer
    -q      Quiet
    -P DIR      Save to DIR (default .)
    -S          Show server response
    -T SEC      Network read timeout is SEC seconds
    -O FILE     Save to FILE ('-' for stdout)
    -U STR      Use STR for User-Agent header
    -Y on/off   Use proxy

wget公式のAlpineリポジトリでもGNUを見つけることができるので、フルバージョンを入手するのはとても簡単です。

apk update
apk add wget

その後、wgetGNUをインストールすると、使用した他のシステムと同様に機能する必要があります。

# wget --help | grep -A1 content-disposition
       --content-disposition       honor the Content-Disposition header when
                                     choosing local file names (EXPERIMENTAL)

おすすめ記事