From 9726e537cb1f64efbcf3e461761097970816357b Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 26 Jan 2017 15:40:45 +0100 Subject: [PATCH] detached install-source --- clone/utility/install-source | 25 +++++++++++++++++++++++++ clone/utility/sats-boot | 2 +- clone/utility/sats-boot.service | 1 - clone/utility/sats-loop | 22 +--------------------- clone/utility/sats-loop.service | 1 - 5 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 clone/utility/install-source diff --git a/clone/utility/install-source b/clone/utility/install-source new file mode 100644 index 0000000..f98e121 --- /dev/null +++ b/clone/utility/install-source @@ -0,0 +1,25 @@ +#!/bin/sh + +# [1] First install only +#========================================================# +if [ -e /home/sats/satsd/first_install ]; then + + dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; + + # (1) With git if installed # + if [ $gitinstalled -eq 1 ]; then + + git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \ + && rm /home/sats/satsd/first_install \ + || exit; + + # (2) Without git installed # + else + + # temporary replacement (without git) + scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \ + && rm /home/sats/satsd/first_install \ + || exit; + fi; + +fi; diff --git a/clone/utility/sats-boot b/clone/utility/sats-boot index 1f0a450..fd629ec 100644 --- a/clone/utility/sats-boot +++ b/clone/utility/sats-boot @@ -12,4 +12,4 @@ echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; sudo systemctl start ssh; # [4] Try to install necessary packages -sudo apt-get -y install git; +sudo apt-get -y install git php5 php5-cli; diff --git a/clone/utility/sats-boot.service b/clone/utility/sats-boot.service index f70df75..ce10449 100644 --- a/clone/utility/sats-boot.service +++ b/clone/utility/sats-boot.service @@ -2,7 +2,6 @@ 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 c571571..f06ecf4 100644 --- a/clone/utility/sats-loop +++ b/clone/utility/sats-loop @@ -4,27 +4,7 @@ test $# -lt 1 && exit; # [1] first install (install source code) -if [ -e /home/sats/satsd/first_install ]; then - - dpkg -s git 2>/dev/null >/dev/null && usegit=1 || usegit=0; - - # install source code - if [ $usegit -eq 1 ]; then - - git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \ - && rm /home/sats/satsd/first_install \ - || exit; - - else - - # temporary replacement (without git) - scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \ - && rm /home/sats/satsd/first_install \ - || exit; - fi; - -fi; - +sh /home/sats/satsd/install-source; # [2] Propagate script if [ "$1" = "daemon" ]; then diff --git a/clone/utility/sats-loop.service b/clone/utility/sats-loop.service index e2f4a0d..f721570 100644 --- a/clone/utility/sats-loop.service +++ b/clone/utility/sats-loop.service @@ -1,7 +1,6 @@ [Unit] Description=SATS (Secure Authentication and Tracking SYSTEM) Daemon Wants=sats-boot.service -After=sats-boot.service [Service] Type=simple