From 865a2d5d1e95d164f3138538c2697500a7cb7454 Mon Sep 17 00:00:00 2001 From: ske087 Date: Tue, 1 Apr 2025 12:13:51 +0300 Subject: [PATCH] added Install Sh --- install.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..5485e80 --- /dev/null +++ b/install.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Define variables +REPO_URL="https://gitea.moto-adv.com/ske087/signage-player.git" # Replace with your Gitea repository URL +PROJECT_DIR="digital-signage-player" +SERVICE_NAME="digital-signage-player.service" + +# Step 1: Update the system +echo "Updating the system..." +sudo apt-get update -y +sudo apt-get upgrade -y + +# Step 2: Clone the repository +echo "Cloning the repository from $REPO_URL..." +if [ -d "$PROJECT_DIR" ]; then + echo "Project directory already exists. Pulling the latest changes..." + cd "$PROJECT_DIR" && git pull && cd .. +else + git clone "$REPO_URL" +fi + +# Step 3: Set permissions for the project directory +echo "Setting permissions for the project directory to 0777..." +sudo chmod -R 0777 "$PROJECT_DIR" + +# Step 4: Navigate to the project directory +cd "$PROJECT_DIR" || { echo "Failed to navigate to project directory."; exit 1; } + +# Step 5: Install Python dependencies +echo "Installing Python dependencies from requirements.txt..." +pip install -r requirements.txt + +# Step 6: Install system dependencies for ffpyplayer +echo "Installing system dependencies for ffpyplayer..." +sudo apt-get install -y libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev +sudo apt-get install -y libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libpostproc-dev + +# Step 7: Install ffpyplayer +echo "Installing ffpyplayer..." +pip install ffpyplayer + +# Step 8: Create a systemd service for autostart +echo "Creating systemd service for autostart..." +SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME" +sudo bash -c "cat > $SERVICE_FILE" <