install.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # Update and install dependencies
  3. sudo apt-get update
  4. sudo apt-get install -y git python3 python3-pip
  5. # Install Python requirements
  6. pip3 install -r requirements.txt
  7. # Check if the application is already in autostart
  8. AUTOSTART_FILE="/etc/xdg/lxsession/LXDE-pi/autostart"
  9. RUN_COMMAND="@reboot $(pwd)/run.sh"
  10. if ! grep -Fxq "$RUN_COMMAND" "$AUTOSTART_FILE"; then
  11. echo "The application is not in the autostart list."
  12. # Ask the user if they want to add it to the autostart
  13. read -p "Do you want to add the application to the autostart? (y/n) " choice
  14. case "$choice" in
  15. y|Y )
  16. echo "Adding the application to the autostart."
  17. sudo sh -c "echo '$RUN_COMMAND' >> $AUTOSTART_FILE"
  18. echo "The application has been added to the autostart."
  19. ;;
  20. n|N )
  21. echo "The application will not be added to the autostart."
  22. ;;
  23. * )
  24. echo "Invalid choice. The application will not be added to the autostart."
  25. ;;
  26. esac
  27. else
  28. echo "The application is already in the autostart list."
  29. fi