Skip to content

Instantly share code, notes, and snippets.

@muzea
Last active May 14, 2019 15:35
Show Gist options
  • Save muzea/a72901ec35c8cf75fa59028d3c93b5bd to your computer and use it in GitHub Desktop.
Save muzea/a72901ec35c8cf75fa59028d3c93b5bd to your computer and use it in GitHub Desktop.
quick get hustoj deb
#!/bin/bash
# set -e
ID=`cat /etc/os-release | grep '^ID='`
VERSION_ID=`cat /etc/os-release | grep '^VERSION_ID='`
installed=0
handleUbuntu() {
if [[ ! $ID =~ 'ubuntu' ]]; then
return 1
fi
if [[ ! $VERSION_ID =~ '18.04' ]]; then
return 1
fi
resource=`curl -i https://api.github.com/repos/zhblue/hustoj/releases/latest 2>/dev/null | grep browser_download_url | awk '{gsub(/^["]/, "", $2); gsub(/["]$/, "", $2); print $2}' | grep ubuntu18`
deb=`echo $resource | awk -F / '{print $9}'`
# echo $deb
# echo $resource
curl -L $resource > /tmp/$deb
apt update
dpkg -i /tmp/$deb
apt-get install -f -y
dpkg -i /tmp/$deb
installed=1
}
handleDebian() {
if [[ ! $ID =~ 'debian' ]]; then
return 1
fi
if [[ ! $VERSION_ID =~ '8' ]]; then
return 1
fi
resource=`curl -i https://api.github.com/repos/zhblue/hustoj/releases/latest 2>/dev/null | grep browser_download_url | awk '{gsub(/^["]/, "", $2); gsub(/["]$/, "", $2); print $2}' | grep debian8`
deb=`echo $resource | awk -F / '{print $9}'`
# echo $deb
# echo $resource
curl -L $resource > /tmp/$deb
apt update
dpkg -i /tmp/$deb
apt-get install -f -y
dpkg -i /tmp/$deb
installed=1
}
handleDebian
handleUbuntu
if [ $installed == 0 ]; then
echo 'This Linux distribution is currently not supported.'
else
echo 'The installation is complete, you can use "/etc/init.d/hustoj start" to launch the app.'
fi
@muzea
Copy link
Author

muzea commented May 14, 2019

bash -c "$(curl -fsSL https://gist.githubusercontent.com/muzea/a72901ec35c8cf75fa59028d3c93b5bd/raw/43c2c27c37f07aa23b385a8b394175ecdd165479/get_hustoj_deb.sh)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment