pokeplatinum/tools/devtools/get_metroskrew.sh
Rachel 1a68c758eb
Some checks are pending
build / build (push) Waiting to run
Integrate metroskrew as the default compiler (#482)
* Remove extraneous `include/` directory level from brightness_controller

* Wrap WSL_ACCESSING_WINDOWS detection in realpath

* Integrate metroskrew as the default compiler

* Remove tools/cw contents
2025-05-09 22:00:48 -07:00

44 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: Run this script from the project root and provide the following environment variables:
# - SKREW_SYS - controls the distribution downloaded; either `windows`, `linux`, or `wine`
# - SKREW_VER - the release version of the metroskrew archive to be downloaded
# - SKREW_DIR - the subproject directory in which metroskrew shall be stored
set -euxo pipefail
case "$SKREW_SYS" in
windows)
SKREW_EXT=".7z"
EXTRACTOR="p7zip -d"
;;
linux | wine)
SKREW_EXT=".tar.xz"
EXTRACTOR="tar xf"
;;
*)
echo "Unrecognized platform $SKREW_SYS"
exit 1
;;
esac
TMP="/tmp"
SKREW="metroskrew"
SKREW_GH="https://github.com/mid-kid/$SKREW"
SKREW_ARC="metroskrew-$SKREW_SYS$SKREW_EXT"
SKREW_URL="$SKREW_GH/releases/download/$SKREW_VER/$SKREW_ARC"
SKREW_TMP="$TMP/$SKREW"
rm -rf "$SKREW_DIR"
# We extract the archive to `/tmp` to ensure that Windows does not muddle with permissions.
pushd "$TMP" >/dev/null
wget --quiet --show-progress -O "$SKREW_ARC" "$SKREW_URL"
$EXTRACTOR "$SKREW_ARC"
popd >/dev/null
mv "$SKREW_TMP" "$SKREW_DIR"