bootstrap: librespeed-cli: feat: Add macOS support

This commit is contained in:
PorridgePi
2022-09-29 17:49:03 +08:00
parent 88176cdd3e
commit 967e146480

View File

@@ -5,8 +5,6 @@ if ! command -v librespeed-cli &> /dev/null; then
if [[ "$OSNAME" == "Linux" ]]; then if [[ "$OSNAME" == "Linux" ]]; then
# Linux # Linux
if [[ "$DISTRO_TYPE" == "debian" ]]; then
# Debian-based
if [[ "$ARCH" == "aarch64" ]]; then if [[ "$ARCH" == "aarch64" ]]; then
ARCH=arm64 ARCH=arm64
fi fi
@@ -16,15 +14,14 @@ if ! command -v librespeed-cli &> /dev/null; then
tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/ tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/
cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/ cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/
rm -r $HOME/.temp/librespeed/ rm -r $HOME/.temp/librespeed/
else
# Unknown distro
echo 'ERROR: Unknown distro'
echo 'Exiting...'
exit 1
fi
elif [[ "$OSNAME" == "macOS" ]]; then elif [[ "$OSNAME" == "macOS" ]]; then
# macOS # macOS
exit 1 URL=$(curl -fsSL https://api.github.com/repos/librespeed/speedtest-cli/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep darwin | grep $ARCH)
mkdir -p $HOME/.temp/librespeed
curl -fsSL -o $HOME/.temp/librespeed/librespeed.tar.gz "$URL"
tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/
cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/
rm -r $HOME/.temp/librespeed/
else else
# Unknown # Unknown
echo 'ERROR: Unknown OS' echo 'ERROR: Unknown OS'