This repository has no description
569 B
23 lines
1#!/usr/bin/env bash
2set -euo pipefail
3
4url="https://boosteroid.com/linux/installer/boosteroid_portable.tar"
5pkg="$(dirname "$(realpath "$0")")/package.nix"
6
7old_hash=$(grep -oP 'hash = "\K[^"]+' "$pkg")
8
9tmpfile=$(mktemp)
10trap 'rm -f "$tmpfile"' EXIT
11
12curl -fsSL -A "Mozilla/5.0" -o "$tmpfile" "$url"
13new_hash=$(nix hash file --sri "$tmpfile")
14
15if [ "$old_hash" = "$new_hash" ]; then
16 echo "boosteroid: already up to date ($old_hash)"
17 exit 0
18fi
19
20echo "boosteroid: updating hash"
21echo " old: $old_hash"
22echo " new: $new_hash"
23sed -i "s|$old_hash|$new_hash|" "$pkg"