#!/bin/bash # Update and install dependencies sudo apt-get update sudo apt-get install -y git python3 python3-pip # Install Python requirements pip3 install -r requirements.txt # Check if the application is already in autostart AUTOSTART_FILE="/etc/xdg/lxsession/LXDE-pi/autostart" RUN_COMMAND="@reboot $(pwd)/run.sh" if ! grep -Fxq "$RUN_COMMAND" "$AUTOSTART_FILE"; then echo "The application is not in the autostart list." # Ask the user if they want to add it to the autostart read -p "Do you want to add the application to the autostart? (y/n) " choice case "$choice" in y|Y ) echo "Adding the application to the autostart." sudo sh -c "echo '$RUN_COMMAND' >> $AUTOSTART_FILE" echo "The application has been added to the autostart." ;; n|N ) echo "The application will not be added to the autostart." ;; * ) echo "Invalid choice. The application will not be added to the autostart." ;; esac else echo "The application is already in the autostart list." fi