updated to ruun app .sh
This commit is contained in:
19
Install.sh
19
Install.sh
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user