shellcheck: fix lint of package helper bash scripts
This commit is contained in:
committed by
Erik Arvstedt
parent
9a92d29111
commit
a59c3b4b8a
@@ -2,44 +2,45 @@
|
||||
#! nix-shell -i bash -p nodePackages.node2nix gnupg wget jq moreutils gnused
|
||||
set -euo pipefail
|
||||
|
||||
TMPDIR="$(mktemp -d -p /tmp)"
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
TMPDIR=$(mktemp -d -p /tmp)
|
||||
trap 'rm -rf $TMPDIR' EXIT
|
||||
|
||||
version="0.3.1"
|
||||
repo=https://github.com/shesek/spark-wallet
|
||||
|
||||
# Fetch and verify source tarball
|
||||
file=spark-wallet-${version}-npm.tgz
|
||||
url=$repo/releases/download/v$version/$file
|
||||
url=$repo/releases/download/v${version}/$file
|
||||
export GNUPGHOME=$TMPDIR
|
||||
gpg --keyserver hkps://keyserver.ubuntu.com --recv-key FCF19B67866562F08A43AAD681F6104CD0F150FC
|
||||
wget -P $TMPDIR $url
|
||||
wget -P $TMPDIR $repo/releases/download/v$version/SHA256SUMS.asc
|
||||
gpg --verify $TMPDIR/SHA256SUMS.asc
|
||||
(cd $TMPDIR; sha256sum --check --ignore-missing SHA256SUMS.asc)
|
||||
hash=$(nix hash file $TMPDIR/$file)
|
||||
wget -P "$TMPDIR" "$url"
|
||||
wget -P "$TMPDIR" "$repo/releases/download/v${version}/SHA256SUMS.asc"
|
||||
gpg --verify "$TMPDIR/SHA256SUMS.asc"
|
||||
(cd "$TMPDIR"; sha256sum --check --ignore-missing SHA256SUMS.asc)
|
||||
hash=$(nix hash file "$TMPDIR/$file")
|
||||
|
||||
# Extract source
|
||||
src=$TMPDIR/src
|
||||
mkdir $src
|
||||
tar xvf $TMPDIR/$file -C $src --strip-components 1 >/dev/null
|
||||
mkdir "$src"
|
||||
tar xvf "$TMPDIR/$file" -C "$src" --strip-components 1 >/dev/null
|
||||
|
||||
# Make qrcode-terminal a strict dependency so that node2nix includes it in the package derivation.
|
||||
jq '.dependencies["qrcode-terminal"] = .optionalDependencies["qrcode-terminal"]' $src/package.json | sponge $src/package.json
|
||||
jq '.dependencies["qrcode-terminal"] = .optionalDependencies["qrcode-terminal"]' "$src/package.json" | sponge "$src/package.json"
|
||||
|
||||
node2nix \
|
||||
--nodejs-14 \
|
||||
--input $src/package.json \
|
||||
--lock $src/npm-shrinkwrap.json \
|
||||
--input "$src/package.json" \
|
||||
--lock "$src/npm-shrinkwrap.json" \
|
||||
--composition composition.nix \
|
||||
--no-copy-node-env
|
||||
|
||||
# Use node-env.nix from nixpkgs
|
||||
# shellcheck disable=SC2016
|
||||
nodeEnvImport='import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix"'
|
||||
sed -i "s|import ./node-env.nix|$nodeEnvImport|" composition.nix
|
||||
|
||||
# Use the verified package src
|
||||
read -d '' fetchurl <<EOF || :
|
||||
read -rd '' fetchurl <<EOF || :
|
||||
fetchurl {
|
||||
url = "$url";
|
||||
hash = "$hash";
|
||||
|
||||
Reference in New Issue
Block a user