From d911a2e9a6b2985f0b43e85aa4bf011a3962eb55 Mon Sep 17 00:00:00 2001 From: Simon C Date: Tue, 17 Mar 2020 14:08:51 +0100 Subject: [PATCH] feat: Add architecture on hugo script --- scripts/hugo.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/hugo.sh b/scripts/hugo.sh index 6b4368c..5c1351b 100755 --- a/scripts/hugo.sh +++ b/scripts/hugo.sh @@ -54,6 +54,17 @@ checkos() { fi } +getArchitecture() { + architecture="$(arch)" + + if [[ $architecture = "armv7l" ]]; + then + echo "ARM" + else + echo "64bit" + fi +} + echo '🐹 Starting hugo install/update' if ! [ -x "$(command -v curl)" ]; @@ -61,8 +72,12 @@ then checkos "curl" fi +architecture=$(getArchitecture) gitlatest="https://api.github.com/repositories/11180687/releases/latest" -url=$(curl -s $gitlatest | grep -o 'https://.*hugo_extended.*_Linux-64bit.tar.gz') +echo $architecture +echo $gitlatest +url=$(curl -s $gitlatest | grep -o "https://.*hugo_extended.*_Linux-$architecture.tar.gz") +echo $url echo '✅ Found the latest version!' echo '' @@ -79,6 +94,6 @@ echo '✅ Extracted to /usr/local/bin' rm hugo_extended_latest.tar.gz echo '' -echo '👉 Current Version' $(hugo version) +echo '👉 Current Version' $(./hugo version) echo '' echo '🎉 DONE! 🎉'