1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p nix nix-prefetch-git coreutils curl jq gnused
6 # Will be replaced with the actual branch when running this from passthru.updateScript
9 if [[ ! "$(basename $PWD)" = "citra" ]]; then
10 echo "error: Script must be ran from citra's directory!"
15 pushd ..
/..
/..
/..
>/dev
/null
16 nix
eval --raw -f default.nix
"$1".version
21 pushd ..
/..
/..
/..
>/dev
/null
22 nix
eval --raw -f default.nix
"$1".src.drvAttrs.outputHash
27 OLD_NIGHTLY_VERSION
="$(getLocalVersion "citra-nightly
")"
28 OLD_NIGHTLY_HASH
="$(getLocalHash "citra-nightly
")"
30 NEW_NIGHTLY_VERSION
="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
31 "https
://api.github.com
/repos
/citra-emu
/citra-nightly
/releases?per_page
=1" | jq -r '.[0].name' | cut -d"-" -f2 | cut -d" " -f2)"
33 if [[ "${OLD_NIGHTLY_VERSION}" = "${NEW_NIGHTLY_VERSION}" ]]; then
34 echo "citra-nightly is already up to date!"
36 [ "$KEEP_GOING" ] && return ||
exit
38 echo "citra-nightly: ${OLD_NIGHTLY_VERSION} -> ${NEW_NIGHTLY_VERSION}"
41 echo " Fetching source code..."
43 NEW_NIGHTLY_HASH
="$(nix-prefetch-git --quiet --fetch-submodules --rev "nightly-
${NEW_NIGHTLY_VERSION}" "https
://github.com
/citra-emu
/citra-nightly
" | jq -r '.sha256')"
45 echo " Successfully fetched. hash: ${NEW_NIGHTLY_HASH}"
47 sed -i "s|${OLD_NIGHTLY_VERSION}|${NEW_NIGHTLY_VERSION}|" .
/default.nix
48 sed -i "s|${OLD_NIGHTLY_HASH}|${NEW_NIGHTLY_HASH}|" .
/default.nix
52 OLD_CANARY_VERSION
="$(getLocalVersion "citra-canary
")"
53 OLD_CANARY_HASH
="$(getLocalHash "citra-canary
")"
55 NEW_CANARY_VERSION
="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
56 "https
://api.github.com
/repos
/citra-emu
/citra-canary
/releases?per_page
=1" | jq -r '.[0].name' | cut -d"-" -f2 | cut -d" " -f1)"
58 if [[ "${OLD_CANARY_VERSION}" = "${NEW_CANARY_VERSION}" ]]; then
59 echo "citra-canary is already up to date!"
61 [ "$KEEP_GOING" ] && return ||
exit
63 echo "citra-canary: ${OLD_CANARY_VERSION} -> ${NEW_CANARY_VERSION}"
66 echo " Fetching source code..."
68 NEW_CANARY_HASH
="$(nix-prefetch-git --quiet --fetch-submodules --rev "canary-
${NEW_CANARY_VERSION}" "https
://github.com
/citra-emu
/citra-canary
" | jq -r '.sha256')"
70 echo " Successfully fetched. hash: ${NEW_CANARY_HASH}"
72 sed -i "s|${OLD_CANARY_VERSION}|${NEW_CANARY_VERSION}|" .
/default.nix
73 sed -i "s|${OLD_CANARY_HASH}|${NEW_CANARY_HASH}|" .
/default.nix
76 if [[ "$BRANCH" = "nightly" ]]; then
78 elif [[ "$BRANCH" = "early-access" ]]; then