Last active
May 14, 2019 15:35
-
-
Save muzea/a72901ec35c8cf75fa59028d3c93b5bd to your computer and use it in GitHub Desktop.
quick get hustoj deb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash -c "$(curl -fsSL https://gist.githubusercontent.com/muzea/a72901ec35c8cf75fa59028d3c93b5bd/raw/43c2c27c37f07aa23b385a8b394175ecdd165479/get_hustoj_deb.sh)"