diff options
author | 2023-03-21 11:58:54 +0000 | |
---|---|---|
committer | 2023-03-21 11:58:54 +0000 | |
commit | 9de00ab38a06ce8add7c46bedadd43eb44b4863c (patch) | |
tree | 11b42c84af418ad6052b0d21ea1a2c5d37d04a17 /resources/libraries/bash/function/hugo.sh | |
parent | bfb848e2bea4c1940d1005ee9d6a6e5eb595e841 (diff) |
feat(core): Fix arch detection
Signed-off-by: pmikus <peter.mikus@protonmail.ch>
Change-Id: I4dcb0034b8f914b7863ac8ddede4d644d64c2d47
Diffstat (limited to 'resources/libraries/bash/function/hugo.sh')
-rw-r--r-- | resources/libraries/bash/function/hugo.sh | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/resources/libraries/bash/function/hugo.sh b/resources/libraries/bash/function/hugo.sh index b8d4c87df2..b2e4387edd 100644 --- a/resources/libraries/bash/function/hugo.sh +++ b/resources/libraries/bash/function/hugo.sh @@ -20,12 +20,18 @@ function go_install () { # Install Go. - go_version="go1.20.2.linux-arm64.tar.gz" + OS_ARCH=$(uname -m) || die "Failed to get arch." + case "${OS_ARCH}" in + x86_64) architecture="amd64" ;; + aarch64) architecture="arm64" ;; + esac + + go_version="go1.20.2.linux-${architecture}.tar.gz" go_url="https://go.dev/dl" wget "${go_url}/${go_version}" rm -rf "/usr/local/go" - tar -C "/usr/local" -xzf "go1.20.2.linux-arm64.tar.gz" - rm "go1.20.2.linux-arm64.tar.gz" + tar -C "/usr/local" -xzf "go1.20.2.linux-${architecture}.tar.gz" + rm "go1.20.2.linux-${architecture}.tar.gz" export PATH=$PATH:/usr/local/go/bin } @@ -75,7 +81,13 @@ function hugo_install () { # Install Hugo Extended. - hugo_version="v0.111.3/hugo_extended_0.111.3_linux-arm64.deb" + OS_ARCH=$(uname -m) || die "Failed to get arch." + case "${OS_ARCH}" in + x86_64) architecture="amd64" ;; + aarch64) architecture="arm64" ;; + esac + + hugo_version="v0.111.3/hugo_extended_0.111.3_linux-${architecture}.deb" hugo_url="https://github.com/gohugoio/hugo/releases/download" hugo_link="${hugo_url}/${hugo_version}" wget -O "hugo.deb" "${hugo_link}" || die "Failed to install Hugo!" |