Skip to content

Commit ef7075a

Browse files
initanmolanmol.sharma
andauthored
Add installation support for multiple platforms (#19)
Co-authored-by: anmol.sharma <anmolsha@cisco.com>
1 parent 3ec72e5 commit ef7075a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bin/install

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ readonly g_download_url_template=https://github.com/__GITHUB_COORDINATES__/relea
3131
#
3232
readonly g_binary_path_in_archive_template=__ARCHIVE_DIR__/__BINARY_NAME__
3333
readonly g_downloaded_file_is_not_an_archive=false
34-
readonly g_platform_pattern=uname_l_dash_amd64 # one of uname_c_x86_64|uname_l_dash_amd64|uname_l_underscore_amd64|custom
34+
readonly g_platform_pattern=custom # one of uname_c_x86_64|uname_l_dash_amd64|uname_l_underscore_amd64|custom
3535

3636
# Borrowed to someone, but I don't remember who it was, sorry :(
3737
# Print message $2 with log-level $1 to STDERR, colorized if terminal
@@ -188,7 +188,17 @@ get_platform() {
188188
}
189189

190190
get_platform_custom() {
191-
echo "NOT USED"
191+
local machine_hardware_name
192+
machine_hardware_name=${ASDF_OVERWRITE_ARCH:-"$(uname -m)"}
193+
194+
case "${machine_hardware_name}" in
195+
'x86_64') local cpu_type="amd64" ;;
196+
'aarch64') local cpu_type="arm64" ;;
197+
'armv7l') local cpu_type="arm" ;;
198+
*) local cpu_type="${machine_hardware_name}" ;;
199+
esac
200+
201+
echo "$(uname | tr '[:upper:]' '[:lower:]')-${cpu_type}"
192202
}
193203

194204
get_platform_uname_c_x86_64() {

0 commit comments

Comments
 (0)