This repository has been archived on 2024-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
thelinuxlist/scripts/hugoinstall.sh

49 lines
1.6 KiB
Bash
Raw Normal View History

2023-08-04 01:06:24 -07:00
#!/usr/bin/env bash
2023-08-04 01:30:15 -07:00
trap 'exit 130' INT
2023-08-04 01:06:24 -07:00
while true
do
read -r -p "Would you like to install Hugo? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
break
;;
*)
echo "That wasn't an option..."
;;
esac
done
if [ ! -x /usr/bin/curl ] ; then
CURL_NOT_EXIST=1
apt install -y curl
else
CURL_NOT_EXIST=0
fi
apt remove golang -y
2023-08-04 01:30:15 -07:00
apt autoremove -y
wget -O goinstall.sh https://sop.wtf/sh/u/goinstall && bash goinstall.sh
2023-08-04 01:06:24 -07:00
rm -rf /tmp/hugo/
mkdir /tmp/hugo/
VER=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
if [ -n "$(uname -a | grep x86_64)" ]; then
2023-10-04 03:13:13 -07:00
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"_linux-amd64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"_linux-amd64.tar.gz"
2023-08-04 01:06:24 -07:00
fi
if [ -n "$(uname -a | grep armv6l)" ]; then
2023-10-04 03:13:13 -07:00
curl -fsSL -o "/tmp/hugo/hugo_extended_"$VER"-arm64.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_extended_"$VER"-arm64.tar.gz"
2023-08-04 01:06:24 -07:00
fi
if [ -n "$(uname -a | grep armv7l)" ]; then
curl -fsSL -o "/tmp/hugo/hugo_"$VER"-arm.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v$VER/hugo_"$VER"-arm.tar.gz"
2023-10-04 03:13:13 -07:00
echo "Hugo Extended is not supported on armv7l, Installing Hugo standard"
sudo apt update
sudo apt install snapd
sudo snap install dart-sass
2023-08-04 01:06:24 -07:00
fi
cd /tmp/hugo/
tar -xzf /tmp/hugo/*.tar.gz
sudo mv /tmp/hugo/hugo /usr/local/bin
2023-08-04 01:30:15 -07:00
cd ~