xin/bins/sfetch.nix

20 lines
486 B
Nix
Raw Normal View History

2023-09-12 08:44:05 -06:00
{ curl
, gosignify
,
2023-07-11 09:12:50 -06:00
}: ''
2022-10-17 11:12:01 -06:00
#!/usr/bin/env sh
2022-08-25 12:21:35 -06:00
2022-10-17 11:12:01 -06:00
set -e
2022-08-25 12:21:35 -06:00
2022-10-17 11:12:01 -06:00
SERVER=cdn.openbsd.org
ITEM=$1
2022-11-03 12:22:47 -06:00
MACHINE=''${2:-amd64}
2024-02-25 12:45:28 -07:00
V="$(echo $ITEM | sed 's/[^0-9]*//g')"
2022-10-17 11:12:01 -06:00
[[ ! -z $2 ]] && MACHINE=$2
${curl}/bin/curl -s -o "$PWD/$ITEM" "https://$SERVER/pub/OpenBSD/snapshots/$MACHINE/$ITEM" && \
${curl}/bin/curl -s -o "$PWD/SHA256.sig" "https://$SERVER/pub/OpenBSD/snapshots/$MACHINE/SHA256.sig"
2022-08-25 12:21:35 -06:00
2022-10-17 11:12:01 -06:00
${gosignify}/bin/gosignify -C -p "/etc/signify/openbsd-$V-base.pub" -x SHA256.sig "$ITEM"
2022-08-25 12:21:35 -06:00
''