From ec53463a82f5d8b6cf4ed4efe9bac8f25d439a98 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 14 Aug 2024 11:42:51 +0200 Subject: [PATCH] Addded Removing old Files shortened Links --- README.md | 4 ++-- setup.sh | 47 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ac4b8da..98a4296 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ For installation download and run setup.sh. This will install the nesecary depen It will also create a SystemD service to automaticly start the program when the Pi is booted. ```bash -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/setup.sh" -chmod 755 setup.sh +wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/setup.sh" && +chmod 755 setup.sh && ./setup.sh ``` diff --git a/setup.sh b/setup.sh index 6afb1a6..c92c4e1 100755 --- a/setup.sh +++ b/setup.sh @@ -48,20 +48,55 @@ echo -e "${GREEN}======== Holle Datein ========${NOCOLOR}" mkdir ~/PiVideo/ ~/PiVideo/videos/ cd ~/PiVideo/ -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/video.py" +GH_URL="https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/" + +if [ -f "~/PiVideo/video.py" ] # Checking if file exsists +then + echo "Script exists, updateing ..." + rm ~/PiVideo/video.py # Removing Old File + + wget -L $GH_URL"video.py" + + rm ~/PiVideo/*.sh # Removing Old Files + wget -L $GH_URL"start.sh" + wget -L $GH_URL"stop.sh" + wget -L $GH_URL"reload" +else + wget -L $GH_URL"video.py" + wget -L $GH_URL"start.sh" + wget -L $GH_URL"stop.sh" + wget -L $GH_URL"reload" +fi + -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/start.sh" -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/stop.sh" -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/reload.sh" chmod 755 *.sh echo -e "${GREEN}======== Holle Videos========${NOCOLOR}" cd videos/ -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/videos/loop.mp4" -wget -L "https://raw.githubusercontent.com/miT-nib-hcI/PiVideo/main/videos/trigger.mp4" +if ls ~/PiVideo/videos/loop* 1> /dev/null 2>&1; # Checking if file exsists +then + echo "Video exists, updateing ..." + rm ~/PiVideo/videos/loop* # Removing Old Files + + wget -L $GH_URL"videos/loop.mp4" +else + wget -L $GH_URL"videos/loop.mp4" +fi + + + +if ls ~/PiVideo/videos/loop* 1> /dev/null 2>&1; # Checking if file exsists +then + echo "Video exists, updateing ..." + rm ~/PiVideo/videos/trigger* # Removing Old Files + + wget -L $GH_URL"videos/trigger.webm" +else + wget -L $GH_URL"videos/trigger.webm" +fi cd .. echo -e "${GREEN}======== Erestele Systemd Service ========${NOCOLOR}"