Skip to content

Commit

Permalink
Linuxにinstall.shを実行してインストールする時に適切なアーキテクチャを選択する (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ophum authored Apr 8, 2024
1 parent 94d984b commit 9ea3d6a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,33 @@ SCRIPT
}

install_with_curl() {
detect_arch
echo "===== install usacloud by curl ====="
sudo sh <<'SCRIPT'
curl -LO https://github.com/sacloud/usacloud/releases/latest/download/usacloud_linux-amd64.zip
unzip -j usacloud_linux-amd64.zip usacloud && rm usacloud_linux-amd64.zip
sudo sh <<SCRIPT
curl -LO https://github.com/sacloud/usacloud/releases/latest/download/usacloud_linux-${ARCH}.zip
unzip -j usacloud_linux-${ARCH}.zip usacloud && rm usacloud_linux-${ARCH}.zip
chmod +x usacloud
mv usacloud /usr/local/bin/
SCRIPT
}

detect_arch() {
ARCH=$(uname -m)
case "$ARCH" in
"i386" | "i686")
ARCH="386" ;;
"amd64"| "x86_64")
ARCH="amd64" ;;
"arm" | "aarch32")
ARCH="arm" ;;
"arm64" | "aarch64")
ARCH="arm64" ;;
*)
echo "Your platform ($(uname -a)) is not supported."
exit 1 ;;
esac
}

### main
set -e
sudo -k
Expand Down

0 comments on commit 9ea3d6a

Please sign in to comment.