install_latest_hkwtc.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. # Automatic install script for ArozOS - by tobychui
  3. # For internal use only, All Right Reserved
  4. echo "[ArozOS Installer]"
  5. echo "Updating apt"
  6. sudo apt upgrade -y
  7. sudo apt-get update -y
  8. sudo apt-get install ffmpeg samba git net-tools -y
  9. echo "Cloning ArozOS from source"
  10. git clone https://git.hkwtc.org/TC/arozos.git
  11. echo "Installing Golang"
  12. arch=$(uname -i)
  13. gover="1.17.6"
  14. if [[ $arch == x86_64* ]]; then
  15. echo "Selecting x64 Architecture"
  16. wget https://golang.org/dl/go$gover.linux-amd64.tar.gz
  17. elif [[ $arch == arm* ]]; then
  18. echo "Selecting ARM Architecture"
  19. wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
  20. elif [[ $arch == "unknown" ]]; then
  21. echo "Unknown CPU arch. Please enter CPU architecture manually (arm/arm64/amd64)"
  22. read -p "Architecture: " arch
  23. if [ "$arch" = "arm" ]; then
  24. echo "Installing arm version of go"
  25. wget https://golang.org/dl/go$gover.linux-armv6l.tar.gz
  26. fi
  27. if [ "$arch" = "arm64" ]; then
  28. echo "Installing arm64 version of go"
  29. wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
  30. fi
  31. if [ "$arch" = "amd64" ]; then
  32. echo "Installing amd64 version of go"
  33. wget https://golang.org/dl/go$gover.linux-amd64.tar.gz
  34. fi
  35. fi
  36. sudo tar -C /usr/local -xzf go*
  37. echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
  38. PATH=$PATH:/usr/local/go/bin
  39. echo "Building ArozOS"
  40. cd arozos
  41. sudo chmod 777 -R ./
  42. cd src
  43. go mod tidy
  44. go build
  45. echo "Setting up system services"
  46. sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service
  47. cd /etc/systemd/system/
  48. printf "[Unit]\nDescription=ArozOS Cloud Service\nAfter=systemd-networkd-wait-online.service\nWants=systemd-networkd-wait-online.service\n\n[Service]\nType=simple\nExecStartPre=/bin/sleep 10\nWorkingDirectory=/home/pi/arozos/src/\nExecStart=/bin/bash /home/pi/arozos/src/start.sh\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target" | sudo tee -a ./arozos.service
  49. echo "Registering systemctl service"
  50. sudo systemctl start arozos.service
  51. echo "Starting arozos"
  52. sudo systemctl enable arozos.service
  53. thisip=$(hostname -I | cut -d' ' -f1)
  54. echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"