updated to ruun app .sh

This commit is contained in:
2025-06-23 13:56:48 +03:00
parent f5ba9e734f
commit a60ba040d1
2 changed files with 20 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
REPO_URL="https://gitea.moto-adv.com/ske087/signage-player.git"
DEFAULT_INSTALL_DIR="/home/pi/signage-player"
SERVICE_FILE="/etc/systemd/system/signage_player.service"
RUN_APP_FILE="$DEFAULT_INSTALL_DIR/run_app.sh"
# Ask the user whether to use the default installation directory
echo "The default installation directory is: $DEFAULT_INSTALL_DIR"
@@ -82,6 +83,24 @@ else
echo "signage_player.service file created and configured successfully."
fi
# Check and update the working directory in run_app.sh
echo "Checking run_app.sh for correct working directory..."
if [[ -f "$RUN_APP_FILE" ]]; then
CURRENT_WORKING_DIR=$(grep -oP '(?<=^cd ).*' "$RUN_APP_FILE" | head -n 1)
EXPECTED_WORKING_DIR="$INSTALL_DIR/src"
if [[ "$CURRENT_WORKING_DIR" != "$EXPECTED_WORKING_DIR" ]]; then
echo "Updating working directory in run_app.sh..."
sudo sed -i "s|^cd .*|cd $EXPECTED_WORKING_DIR|" "$RUN_APP_FILE"
echo "run_app.sh updated successfully."
else
echo "run_app.sh is already configured correctly."
fi
else
echo "Error: run_app.sh file not found."
exit 1
fi
# Enable the service
echo "Enabling signage_player.service..."
sudo systemctl enable signage_player.service

View File

@@ -3,7 +3,7 @@
# filepath: /home/pi/Desktop/signage-player/run_app.sh
# Navigate to the application directory
cd /home/pi/Desktop/signage-player/src || exit
cd /home/pi/signage-player/src || exit
# Check for the --verbose flag
if [[ "$1" == "--verbose" ]]; then