[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] cksum: add --check-stream=CHECKSUM flag
From: |
Akihiro Suda |
Subject: |
Re: [PATCH] cksum: add --check-stream=CHECKSUM flag |
Date: |
Tue, 17 Dec 2024 04:23:52 +0900 |
Hi, Rob and Pádraig,
> So yes the use case is only for copy & paste, which is of limited use.
Agreed.
> URL="https://raw.githubusercontent.com/coreutils/coreutils/3f144241/DEMO-20241216"
> SHA=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
> SUM=sha256sum; $SUM /dev/null > /dev/null 2>&1 || SUM='shasum -a 256'
> tmpf=$(mktemp) && curl -fs "$URL" > "$tmpf" && $SUM --status --check \
> <(printf '%s -' "$SHA") < "$tmpf" && sh "$tmpf"; rm "$tmpf"
This pattern is too complex and never used in the wild.
Lots of software developers want to appeal that their software can be
installed in a single line without the $<>()&&| symbols.
Better or worse, we have to admit the existence of such one-liners,
and provide a practical workaround that they can be convinced to use.
Examples of one-liners in the wild:
* https://brew.sh
> `/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
* https://www.rust-lang.org/tools/install
> `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
* https://k3s.io
> `curl -sfL https://get.k3s.io | sh -`
*
https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart#install-calico
> `kubectl create -f
https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/tigera-operator.yaml`
(This pattern is Kubernetes's equivalent of `curl https://... | sh`)
* https://cert-manager.io/docs/installation/kubectl/
> `kubectl apply -f
https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml`
* And more:
https://github.com/search?q=%22curl%22+%22%7C+sh%22+OR+%22%7C+sudo+sh%22&type=code
https://github.com/search?q=%22kubectl+apply+-f+https%3A%2F%2F%22&type=code
> Yes it's more concise, but also much less portable.
> The first example above should run on any Linux, FreeBSD/macOS system.
FreeBSD (since 14) and macOS (since 15) began to provide
GNU-compatible sha*sum commands:
https://man.freebsd.org/cgi/man.cgi?query=sha256sum&apropos=0&sektion=0&manpath=FreeBSD+14.0-RELEASE&arch=default&format=html
So I'm sure that my proposal will be supported in FreeBSD and macOS
too if it can be accepted in GNU coreutils.
Regards,
Akihiro Suda