Return to Snippet

Revision: 71021
at November 29, 2016 01:23 by SoroushBlaster


Initial Code
#!/bin/bash
clear screen
echo "Choose your Opertaing System:"
echo "1) Linux 32-bit"
echo "2) Linux 64-bit"
echo "3) Linux ARM"
echo "4) MS Windows 32-bit"
echo "5) MS Windows 64-bit"
echo "6) Darwin OS"
read OS

case $OS in

  1) echo "Linux 32-bit is selected"
     OS2=$"_linux_386.tar.gz"
     OS_Linux="yes"
     ;;
  
  2) echo "Linux 64-bit is selected"
     OS2=$"_linux_amd64.tar.gz"
     OS_Linux="yes"
     ;;
  
  3) echo "Linux ARM is selected"
     OS2=$"_linux_arm.tar.gz"
     OS_Linux="yes"
     ;;
  
  4) echo "MS Windows 32-bit is selected"
     OS2=$"_windows_386.tar.gz"
     OS_Linux="no"
     ;;
  
  5) echo "MS Windows 64-bit is selected"
     OS2=$"_windows_amd64.tar.gz"
     OS_Linux="no"
     ;;
  
  6) echo "Darwin OS is selected"
     OS2=$"_darwin_amd64.tar.gz"
     OS_Linux="no"
     ;;
     
  *) echo "invalid option"
     exit
     ;;
  
esac

Link1=$(wget https://github.com/brocaar/loraserver/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
echo https://github.com${Link2}
rm latest
wget https://github.com${Link2}

Link1=$(wget https://github.com/brocaar/lora-gateway-bridge/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
echo https://github.com${Link2}
rm latest
wget https://github.com${Link2}

Link1=$(wget https://github.com/brocaar/lora-app-server/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
echo https://github.com${Link2}
rm latest
wget https://github.com${Link2}

for a in *.tar.gz; do echo working on $a; tar zxvf $a; done
for b in *.tar.gz; do rm -v $b; done

if [ "$OS_Linux" = 'yes' ]; then
  echo "Linux files detected. Attempting giving executable permission..."
  chmod +x loraserver lora-gateway-bridge lora-app-server
  echo "Done."
fi

Initial URL

                                

Initial Description
This is a simple script which downloads the latest "LoRa Server" files from the repository of the user brocaar in GitHub.
Just make the file executable with a "chmod +x script_installer.sh" and run it, the program will give you the latest releases of the main files according to your OS.

Initial Title
script_installer.sh

Initial Tags
file, server

Initial Language
Bash