Posted By


SoroushBlaster on 11/29/16

Tagged


Statistics


Viewed 874 times
Favorited by 0 user(s)

script_installer.sh


/ Published in: Bash
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2. clear screen
  3. echo "Choose your Opertaing System:"
  4. echo "1) Linux 32-bit"
  5. echo "2) Linux 64-bit"
  6. echo "3) Linux ARM"
  7. echo "4) MS Windows 32-bit"
  8. echo "5) MS Windows 64-bit"
  9. echo "6) Darwin OS"
  10. read OS
  11.  
  12. case $OS in
  13.  
  14. 1) echo "Linux 32-bit is selected"
  15. OS2=$"_linux_386.tar.gz"
  16. OS_Linux="yes"
  17. ;;
  18.  
  19. 2) echo "Linux 64-bit is selected"
  20. OS2=$"_linux_amd64.tar.gz"
  21. OS_Linux="yes"
  22. ;;
  23.  
  24. 3) echo "Linux ARM is selected"
  25. OS2=$"_linux_arm.tar.gz"
  26. OS_Linux="yes"
  27. ;;
  28.  
  29. 4) echo "MS Windows 32-bit is selected"
  30. OS2=$"_windows_386.tar.gz"
  31. OS_Linux="no"
  32. ;;
  33.  
  34. 5) echo "MS Windows 64-bit is selected"
  35. OS2=$"_windows_amd64.tar.gz"
  36. OS_Linux="no"
  37. ;;
  38.  
  39. 6) echo "Darwin OS is selected"
  40. OS2=$"_darwin_amd64.tar.gz"
  41. OS_Linux="no"
  42. ;;
  43.  
  44. *) echo "invalid option"
  45. exit
  46. ;;
  47.  
  48. esac
  49.  
  50. Link1=$(wget https://github.com/brocaar/loraserver/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
  51. Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
  52. echo https://github.com${Link2}
  53. rm latest
  54. wget https://github.com${Link2}
  55.  
  56. Link1=$(wget https://github.com/brocaar/lora-gateway-bridge/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
  57. Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
  58. echo https://github.com${Link2}
  59. rm latest
  60. wget https://github.com${Link2}
  61.  
  62. Link1=$(wget https://github.com/brocaar/lora-app-server/releases/latest > /dev/null 2>&1; cat latest | grep $OS2 | grep href)
  63. Link2=$(echo $Link1 | awk -F'" rel=' '{print $1}' | awk -F '="' '{print $2}')
  64. echo https://github.com${Link2}
  65. rm latest
  66. wget https://github.com${Link2}
  67.  
  68. for a in *.tar.gz; do echo working on $a; tar zxvf $a; done
  69. for b in *.tar.gz; do rm -v $b; done
  70.  
  71. if [ "$OS_Linux" = 'yes' ]; then
  72. echo "Linux files detected. Attempting giving executable permission..."
  73. chmod +x loraserver lora-gateway-bridge lora-app-server
  74. echo "Done."
  75. fi

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.