2020-03-17 13:55:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
installgit() {
|
|
|
|
if ! [ -x "$(command -v git)" ];
|
|
|
|
then
|
|
|
|
echo "Git is not installed\n\nStarting git installation...!"
|
|
|
|
eval $1
|
|
|
|
echo "Done installing git!\n"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
systemtypeinstall() {
|
|
|
|
if [ $1 = "ID=arch" ]; # installing in Arch Linux
|
|
|
|
then
|
|
|
|
echo "Installing $2 🐹🐹🐹🐹\n"
|
|
|
|
cmd=`sudo pacman -S git`
|
|
|
|
installgit $cmd
|
|
|
|
git clone https://aur.archlinux.org/snapd.git &&
|
|
|
|
cd snapd &&
|
|
|
|
makepkg -si &&
|
|
|
|
cd ../ &&
|
|
|
|
rm -rf snapd
|
|
|
|
sudo systemctl enable --now snapd.socket
|
|
|
|
echo "Done🎉🎉🎉🎉🎉🎉!"
|
|
|
|
elif [ $1 = "ID=ubuntu" ] || [ $1 = "ID=Debian" ]; # installing in Ubuntu or Debian
|
|
|
|
then
|
|
|
|
cmd=`sudo apt install git`
|
|
|
|
installgit $cmd
|
|
|
|
$(sudo apt install $2)
|
|
|
|
elif [ $1 = "ID=Fedora" ]; # installing in Fedora
|
|
|
|
then
|
|
|
|
cmd=`sudo apt install git`
|
|
|
|
installgit $cmd
|
|
|
|
$(sudo dnf install $2)
|
|
|
|
else
|
|
|
|
echo "Please find $2 installation for $1 online!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
checkos() {
|
|
|
|
platform="$(uname | tr '[:upper:]' '[:lower:]')" # get which OS you are running
|
|
|
|
|
|
|
|
if [[ $platform = "linux" ]];
|
|
|
|
then
|
|
|
|
if ! [ -x "$(command -v snap)" ];
|
|
|
|
then
|
|
|
|
systemtype=$(grep -w "ID=.*" /etc/os-release)
|
|
|
|
systemtypeinstall $systemtype 'snapd'
|
|
|
|
else
|
|
|
|
$(snap install $1)
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Please find instructions on how to install"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-03-17 14:08:51 +01:00
|
|
|
getArchitecture() {
|
|
|
|
architecture="$(arch)"
|
|
|
|
|
|
|
|
if [[ $architecture = "armv7l" ]];
|
|
|
|
then
|
|
|
|
echo "ARM"
|
|
|
|
else
|
|
|
|
echo "64bit"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-03-17 13:55:49 +01:00
|
|
|
echo '🐹 Starting hugo install/update'
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v curl)" ];
|
|
|
|
then
|
|
|
|
checkos "curl"
|
|
|
|
fi
|
|
|
|
|
2020-03-17 14:08:51 +01:00
|
|
|
architecture=$(getArchitecture)
|
2020-03-17 13:55:49 +01:00
|
|
|
gitlatest="https://api.github.com/repositories/11180687/releases/latest"
|
2020-03-17 14:08:51 +01:00
|
|
|
echo $architecture
|
|
|
|
echo $gitlatest
|
|
|
|
url=$(curl -s $gitlatest | grep -o "https://.*hugo_extended.*_Linux-$architecture.tar.gz")
|
|
|
|
echo $url
|
2020-03-17 13:55:49 +01:00
|
|
|
|
|
|
|
echo '✅ Found the latest version!'
|
|
|
|
echo ''
|
|
|
|
echo '🐹 Downloading the hugo extended latest...!'
|
|
|
|
curl -s $url -L -o hugo_extended_latest.tar.gz
|
|
|
|
|
|
|
|
echo '✅ Download complete: ' $url
|
|
|
|
|
|
|
|
echo "🐹 Extracting archive!"
|
|
|
|
|
|
|
|
tar -zxf hugo_extended_latest.tar.gz hugo
|
|
|
|
|
|
|
|
echo '✅ Extracted to /usr/local/bin'
|
|
|
|
|
|
|
|
rm hugo_extended_latest.tar.gz
|
|
|
|
echo ''
|
2020-03-17 14:08:51 +01:00
|
|
|
echo '👉 Current Version' $(./hugo version)
|
2020-03-17 13:55:49 +01:00
|
|
|
echo ''
|
|
|
|
echo '🎉 DONE! 🎉'
|