@@ -24,10 +24,11 @@ get_download_url() {
|
|||||||
local latest='https://api.github.com/repos/exercism/configlet/releases/latest'
|
local latest='https://api.github.com/repos/exercism/configlet/releases/latest'
|
||||||
local arch
|
local arch
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
x86_64) arch='x86-64' ;;
|
aarch64|arm64) arch='arm64' ;;
|
||||||
*686*) arch='i386' ;;
|
x86_64) arch='x86-64' ;;
|
||||||
*386*) arch='i386' ;;
|
*686*) arch='i386' ;;
|
||||||
*) arch='x86-64' ;;
|
*386*) arch='i386' ;;
|
||||||
|
*) arch='x86-64' ;;
|
||||||
esac
|
esac
|
||||||
local suffix="${os}_${arch}.${ext}"
|
local suffix="${os}_${arch}.${ext}"
|
||||||
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${latest}" |
|
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${latest}" |
|
||||||
@@ -47,7 +48,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local os
|
local os
|
||||||
case "$(uname)" in
|
case "$(uname -s)" in
|
||||||
Darwin*) os='macos' ;;
|
Darwin*) os='macos' ;;
|
||||||
Linux*) os='linux' ;;
|
Linux*) os='linux' ;;
|
||||||
Windows*) os='windows' ;;
|
Windows*) os='windows' ;;
|
||||||
@@ -58,8 +59,8 @@ main() {
|
|||||||
|
|
||||||
local ext
|
local ext
|
||||||
case "${os}" in
|
case "${os}" in
|
||||||
windows*) ext='zip' ;;
|
windows) ext='zip' ;;
|
||||||
*) ext='tar.gz' ;;
|
*) ext='tar.gz' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "Fetching configlet..." >&2
|
echo "Fetching configlet..." >&2
|
||||||
@@ -69,16 +70,16 @@ main() {
|
|||||||
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"
|
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"
|
||||||
|
|
||||||
case "${ext}" in
|
case "${ext}" in
|
||||||
*zip) unzip "${output_path}" -d "${output_dir}" ;;
|
zip) unzip "${output_path}" -d "${output_dir}" ;;
|
||||||
*) tar xzf "${output_path}" -C "${output_dir}" ;;
|
*) tar xzf "${output_path}" -C "${output_dir}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
rm -f "${output_path}"
|
rm -f "${output_path}"
|
||||||
|
|
||||||
local executable_ext
|
local executable_ext
|
||||||
case "${os}" in
|
case "${os}" in
|
||||||
windows*) executable_ext='.exe' ;;
|
windows) executable_ext='.exe' ;;
|
||||||
*) executable_ext='' ;;
|
*) executable_ext='' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
local configlet_path="${output_dir}/configlet${executable_ext}"
|
local configlet_path="${output_dir}/configlet${executable_ext}"
|
||||||
|
|||||||
Reference in New Issue
Block a user