System/sources/update-sources.sh

30 lines
1.1 KiB
Bash
Raw Normal View History

2023-05-14 18:54:38 -04:00
#!/usr/bin/env bash
2023-05-15 07:58:38 -04:00
set -exou pipefail
2023-05-14 18:54:38 -04:00
DIRECTORY=$(realpath "$(dirname "$0")")
# Update swayimg
SWAYIMG_VERSION=$(curl https://api.github.com/repos/artemsen/swayimg/tags | jq -r ".[0].name" | tr -d "v")
SWAYIMG_URL="https://github.com/artemsen/swayimg/archive/refs/tags/v$SWAYIMG_VERSION.tar.gz"
2023-05-15 08:05:01 -04:00
SWAYIMG_HASH=$(nix-prefetch fetchurl --url "$SWAYIMG_URL")
2023-05-14 18:54:38 -04:00
jq --null-input \
--arg version "$SWAYIMG_VERSION" \
--arg url "$SWAYIMG_URL" \
--arg hash "$SWAYIMG_HASH" \
'{"version": $version, "url": $url, "hash": $hash}' \
> $DIRECTORY/swayimg.json
2023-05-14 19:12:18 -04:00
echo "swayimg now at $SWAYIMG_VERSION"
# Update layman
LAYMAN_BRANCH=$(curl https://api.github.com/repos/frap129/layman | jq -r '.default_branch')
LAYMAN_REV=$(curl https://api.github.com/repos/frap129/layman/git/refs/heads/$LAYMAN_BRANCH | \
jq -r '.object.sha')
LAYMAN_HASH=$(nix-prefetch fetchFromGitHub --owner frap129 --repo layman --rev $LAYMAN_REV)
jq --null-input \
--arg rev "$LAYMAN_REV" \
--arg hash "$LAYMAN_HASH" \
'{"rev": $rev, "hash": $hash}' \
> $DIRECTORY/layman.json
2023-05-14 19:25:28 -04:00
echo "layman now at $LAYMAN_REV"