install_for_pi.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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://github.com/tobychui/arozos
  11. echo "Installing Golang"
  12. arch=$(uname -m)
  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-armv6l.tar.gz
  20. elif [[ $arch == "aarch64" ]]; then
  21. echo "Selecting ARM64 Architecture"
  22. wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
  23. elif [[ $arch == "unknown" ]]; then
  24. echo "Unknown CPU arch. Please enter CPU architecture manually (arm/arm64/amd64)"
  25. read -p "Architecture: " arch
  26. if [ "$arch" = "arm" ]; then
  27. echo "Installing arm version of go"
  28. wget https://golang.org/dl/go$gover.linux-armv6l.tar.gz
  29. fi
  30. if [ "$arch" = "arm64" ]; then
  31. echo "Installing arm64 version of go"
  32. wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
  33. fi
  34. if [ "$arch" = "amd64" ]; then
  35. echo "Installing amd64 version of go"
  36. wget https://golang.org/dl/go$gover.linux-amd64.tar.gz
  37. fi
  38. fi
  39. sudo tar -C /usr/local -xzf go*
  40. echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
  41. PATH=$PATH:/usr/local/go/bin
  42. echo "Building ArozOS"
  43. cd arozos
  44. sudo chmod 777 -R ./
  45. cd src
  46. go mod tidy
  47. go build
  48. echo "Setting up system services"
  49. sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service
  50. cd /etc/systemd/system/
  51. 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/$USER/arozos/src/\nExecStart=/bin/bash /home/$USER/arozos/src/start.sh\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target" | sudo tee -a ./arozos.service
  52. echo "Registering systemctl service"
  53. sudo systemctl start arozos.service
  54. echo "Starting arozos"
  55. sudo systemctl enable arozos.service
  56. thisip=$(hostname -I | cut -d' ' -f1)
  57. echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"