From efb26a81b050bfada21340888c6a23d8e1d544c2 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 26 Jan 2017 16:40:46 +0100 Subject: [PATCH] Updated loop/boot scripts + service + remote origins --- clone/utility/install-source | 4 +++- clone/utility/sats-boot | 1 + clone/utility/sats-boot.service | 1 + clone/utility/sats-loop | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clone/utility/install-source b/clone/utility/install-source index f02ba15..8cc36fe 100644 --- a/clone/utility/install-source +++ b/clone/utility/install-source @@ -6,6 +6,8 @@ if [ -e /home/sats/satsd/first_install ]; then dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; + BRANCH=$(cat /home/sats/satsd/conf/branch); + # (1) With git if installed # if [ $gitinstalled -eq 1 ]; then @@ -17,7 +19,7 @@ if [ -e /home/sats/satsd/first_install ]; then else # temporary replacement (without git) - scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \ + scp -r smmp-server:/satsd/scp/$BRANCH/source /home/sats/satsd/ \ && rm /home/sats/satsd/first_install \ || exit; fi; diff --git a/clone/utility/sats-boot b/clone/utility/sats-boot index 6a42be9..611241e 100644 --- a/clone/utility/sats-boot +++ b/clone/utility/sats-boot @@ -12,4 +12,5 @@ echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; sudo systemctl start ssh; # [4] Try to install necessary packages +sudo apt-get update; sudo apt-get -y install git php5 php5-cli php-curl; diff --git a/clone/utility/sats-boot.service b/clone/utility/sats-boot.service index ce10449..f70df75 100644 --- a/clone/utility/sats-boot.service +++ b/clone/utility/sats-boot.service @@ -2,6 +2,7 @@ Description=SATS Boot Process Requires=network-online.target After=network-online.target network.target +Before=sats-loop.service [Service] Type=oneshot diff --git a/clone/utility/sats-loop b/clone/utility/sats-loop index 2446315..d4c8b47 100644 --- a/clone/utility/sats-loop +++ b/clone/utility/sats-loop @@ -4,11 +4,13 @@ test $# -lt 1 && exit; # [1] first install (install source code) -sh /home/sats/satsd/install-source; +sh /home/sats/satsd/install-source 2> /home/sats/satsd/log/install-source.log > /home/sats/satsd/log/install-source.log; + # [2] Propagate script if [ "$1" = "daemon" ]; then + sh /home/sats/satsd/source/daemon 2>> /home/sats/satsd/log/daemon.log >> /home/sats/satsd/log/daemon.log; elif [ "$1" = "update" ]; then