6

checksum.sh - Verify Every Install Script

 1 year ago
source link: https://checksum.sh/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

checksum.sh

checksum.sh - Verify Every Install Script

checksum.sh

Checksum.sh is a simple way to download, review, and verify install scripts. If the checksum is OK the script will be printed to stdout, which can be piped to sh or elsewhere. If the checksum doesn’t match it produces an error and nothing is piped. View the code on GitHub.

For example, to install Rust:

checksum https://sh.rustup.rs 8327fa6ce106d2a387fdd02cb95c3607193c2edb | sh

In contrast to Rust’s usual installation which doesn’t verify the checksum:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install

Option 1: Define the checksum function directly

Paste the following into your command line to define the checksum function.

function checksum() {
  s=$(curl -fsSL $1)
  if ! command -v shasum >/dev/null
  then
    alias shasum=sha1sum
  fi
  c=$(echo $s | shasum | awk '{print $1}')
  if [ "$c" = "$2" ]
  then
    echo $s
  else
    echo "invalid checksum $c != $2" 1>&2;
  fi
  unset s
  unset c
}

Option 2: Download the script

Alternatively, you can download, review and verify the checksum.sh script:

curl -O https://checksum.sh/checksum.sh
cat checksum.sh
echo "132e320edb0027470bfd836af8dadf174e4fee0e  checksum.sh" | shasum -c

If everything is OK, you can source the script which will define the checksum function.

source checksum.sh

To download and verify a script pass the URL and the CHECKSUM:

checksum <URL> <CHECKSUM>

The script will be printed out by default so you can inspect it.

If you’re happy with it, you can pipe the script to sh to execute it:

checksum <URL> <CHECKSUM> | sh

If you just want to calculate the checksum for a URL you can omit the CHECKSUM:

checksum <URL>

Examples

Note: If any of these install scripts have changed these commands will error because the checksum will be invalid.

Install Rust

checksum https://sh.rustup.rs 8327fa6ce106d2a387fdd02cb95c3607193c2edb | sh

Install Cape

checksum https://raw.githubusercontent.com/capeprivacy/cli/main/install.sh 2309498bc07fbca42d421f696a605da15d99d939 | sh

Install Nitrogen

checksum https://raw.githubusercontent.com/capeprivacy/nitrogen/main/install.sh 8012d9e1d1420942f0ae6955fc99c790d52e9c3e | sh

Install Nix

checksum https://nixos.org/nix/install 84b31e0093aaa169c1f580c2fbe2397d059d1983 | sh

Install Deno

checksum https://deno.land/install.sh 57a4d67e64d2a7204541b9e131cedb289a79e834 | sh
This site is open source. Improve this page.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK