From 95b6a695a98a76e0217bb225fd5faba0136882ba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:00:58 -0400 Subject: [PATCH] Update update create command.service if not present --- update | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/update b/update index 77f14002..7b81d0d1 100755 --- a/update +++ b/update @@ -74,6 +74,21 @@ else echo "no changes to rpitx.service." fi +FILE=/etc/systemd/system/command.service +if [ -f "$FILE" ]; then + if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then + echo "changed command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 + else + echo "no change to command.service." + fi +else + echo "creating command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." @@ -85,14 +100,6 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi - -if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then - echo "changed rpitx.service." - sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service - FLAG=1 -else - echo "no changes to command.service." -fi grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then