aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/hugo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/function/hugo.sh')
-rw-r--r--resources/libraries/bash/function/hugo.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/resources/libraries/bash/function/hugo.sh b/resources/libraries/bash/function/hugo.sh
index 052e8333fb..4d0e3eccc7 100644
--- a/resources/libraries/bash/function/hugo.sh
+++ b/resources/libraries/bash/function/hugo.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -26,12 +26,12 @@ function go_install () {
aarch64) architecture="arm64" ;;
esac
- go_version="go1.20.2.linux-${architecture}.tar.gz"
+ go_version="go1.22.5.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-${architecture}.tar.gz"
- rm "go1.20.2.linux-${architecture}.tar.gz"
+ sudo rm -rf "/usr/local/go"
+ sudo tar -C "/usr/local" -xzf "go1.22.5.linux-${architecture}.tar.gz"
+ rm "go1.22.5.linux-${architecture}.tar.gz"
export PATH=$PATH:/usr/local/go/bin
}
@@ -45,8 +45,12 @@ function hugo_build_site () {
# Functions called:
# - die - Print to stderr and exit.
+ if ! install go; then
+ go_install || die "Please install Go!"
+ fi
+
if ! installed hugo; then
- die "Please install Hugo!"
+ hugo_install || die "Please install Hugo!"
fi
pushd "${CSIT_DIR}"/docs || die "Pushd failed!"
@@ -64,8 +68,12 @@ function hugo_init_modules () {
# Functions called:
# - die - Print to stderr and exit.
+ if ! install go; then
+ go_install || die "Please install Go!"
+ fi
+
if ! installed hugo; then
- die "Please install Hugo!"
+ hugo_install || die "Please install Hugo!"
fi
hugo_book_url="github.com/alex-shpak/hugo-book"
@@ -92,7 +100,7 @@ function hugo_install () {
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!"
- dpkg -i "hugo.deb" || die "Failed to install Hugo!"
+ sudo dpkg -i "hugo.deb" || die "Failed to install Hugo!"
rm "hugo.deb" || die "Failed to install Hugo!"
}