From 67fff1954fc6ec1fe3932b77340b72de5b66bdd8 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 17 Feb 2017 17:36:33 +0100 Subject: [PATCH] [Fixed] *pi* have the (first_boot) file and clones the code (sudo -u sats) --- clone/clone | 6 +++--- clone/utility/.sats-boot.swp | Bin 0 -> 12288 bytes clone/utility/install-source | 23 ----------------------- clone/utility/sats-boot | 26 +++++++++++++++++++++++--- clone/utility/sats-loop | 7 ++----- 5 files changed, 28 insertions(+), 34 deletions(-) create mode 100644 clone/utility/.sats-boot.swp delete mode 100644 clone/utility/install-source diff --git a/clone/clone b/clone/clone index 4e6d9a4..db87a60 100755 --- a/clone/clone +++ b/clone/clone @@ -265,8 +265,11 @@ step7(){ echo " (.) Create sats-boot script"; sudo cp ./utility/sats-boot /mnt/home/pi/sats-boot; + sudo touch /mnt/home/pi/first_boot; sudo chown 1000:1000 /mnt/home/pi/sats-boot; + sudo chown 1000:1000 /mnt/home/pi/first_boot; sudo chmod 770 /mnt/home/pi/sats-boot; + sudo chmod 770 /mnt/home/pi/first_boot; # (3) Install sats-boot service # echo " (.) Create sats-update service"; @@ -323,8 +326,6 @@ step9(){ sudo mkdir -p /mnt/home/sats/satsd/log; sudo mkdir -p /mnt/home/sats/satsd/conf; sudo mkdir -p /mnt/home/sats/satsd/data; - sudo mkdir -p /mnt/home/sats/satsd/tmp; - sudo touch /mnt/home/sats/satsd/first_boot; # (2) Create default configuration files # echo " (.) Create default configuration/log files"; @@ -339,7 +340,6 @@ step9(){ # (3) Set up SATS botting script # echo " (.) Set up SATS booting script"; cat ./utility/sats-loop | sudo tee /mnt/home/sats/satsd/sats-loop > /dev/null; - cat ./utility/install-source | sudo tee /mnt/home/sats/satsd/install-source > /dev/null; # (4) Set up service unit # echo " (.) Set up service unit (sats-loop.service)"; diff --git a/clone/utility/.sats-boot.swp b/clone/utility/.sats-boot.swp new file mode 100644 index 0000000000000000000000000000000000000000..fc34f209f6fb2d4f7d2a07e7f8589e0567a42e41 GIT binary patch literal 12288 zcmeI2TW=dh6vrp!BAHS^@Wd0RacCOR^(IbA3MQ4(mWlvvq9o8l5=GUDjW4NAR?Dn&tUq62P88*Md*lt)PUc2DIj?l{V-{G=$G0%0D-@#(g{N9lX z{YygaV2Iz9x?y@6GV|lC%S#=3s-Fga5NE0IOD$um`@Z5@dF?FIcU{AEIs%Ts2m+<< zc;`;A+2+i&>8+2Sq^F*IV}zk=as(U!N5Bzq1RMcJz!7i+9D)BU0iBPr_p!NS)dubN z0JtBko`>(%qkD4%905nb5pVk&AQ-~WgI z|Ns6tW4}S)LpP!8&^71`bn7w3zJk7lK7~GpK7ux&%h1EnL(qfJ1JE((hZBr_24&D| z(5uiG#GvmUW$at%3+O}W1L$e!kK>H}3f+Q!fqsU5f_{X)fqKvx=sBnceT_YQ0^Nji zs10$*?(IH|jdR%%a0DCyN5Bzq1RR0?ovLf821q-JDmFIfhFIxV<(_Tv%Padhr!fDgt+vB)O+V0Yvu5ZfGJ= ztzpJijVdb(xVU-XpzP2FO~AMctq92zH)w{oTBIY9+Dx07qH74ObpQhnOiktt{8*Sc z9q7rMN(y0%UimY3HL`iP9J9bj($?qxqzY;bXa+v^HV-hOpi z%z2cbCG+A1v8-;&BBnuoc*wODJ2Jk^L)3GN)oEjHi`G#)DDx^(l!`zoWeO_CxpLkW zI9P5+tG?1A33N;->_VGtvQx}%(b}+qOkN?g85`8k1QPGk@|EqC#kIA~^yt%m4dq;^ zcS6eX(RIiiS)vQ_f{+%yx4HN3wD-a`y)>xN63G!}2`V}g99bAp^X&7;6>O*pZ-A&W tuv2G6sHl?_G?~jul3Izl^G_T!#qn>rICD1_%_5UH{d>}H%hXp9`xBhk2`T^p literal 0 HcmV?d00001 diff --git a/clone/utility/install-source b/clone/utility/install-source deleted file mode 100644 index 333cb73..0000000 --- a/clone/utility/install-source +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# [1] First install only -#========================================================# -if [ -e /home/sats/satsd/first_boot ]; then - - dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; - - BRANCH=$(cat /home/sats/satsd/conf/machine.branch); - - # (1) With git if installed # - if [ $gitinstalled -eq 1 ]; then - - git clone -b $BRANCH ssh://smmp-server/satsd/git /home/sats/satsd/source \ - && rm /home/sats/satsd/first_boot \ - || exit; - - fi; - - # (2) Reboot to activate SPI # - sudo reboot; - -fi; diff --git a/clone/utility/sats-boot b/clone/utility/sats-boot index e7ee543..4897c34 100644 --- a/clone/utility/sats-boot +++ b/clone/utility/sats-boot @@ -16,17 +16,37 @@ sudo apt-get update; sudo apt-get -y install git php5 php5-cli php5-curl python-dev; + + ################################################ #### ONLY ON FIRST BOOT #### ################################################ -if [ -e /home/sats/satsd/first_boot ]; then +if [ -e /home/pi/first_boot ]; then - # [5] Enable SPI device # + dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; + + BRANCH=$(cat /home/sats/satsd/conf/machine.branch); + + # (1) With git if installed # + if [ $gitinstalled -eq 1 ]; then + + sudo -u sats git clone -b $BRANCH ssh://smmp-server/satsd/git /home/sats/satsd/source \ + && rm /home/pi/first_boot \ + || exit; + + fi; + + + + # (2) Enable SPI device # echo "device_tree_param=spi=on" | sudo tee -a /boot/config.txt > /dev/null; echo "dtoverlay=spi-bcm2708" | sudo tee -a /boot/config.txt > /dev/null; - # [6] Clone SPI python library # + # (3) Clone SPI python library # sudo git clone https://github.com/lthiery/SPI-Py.git /home/pi/spi-lib; sudo python /home/pi/spi-lib/setup.py install; + # (4) Reboot to activate SPI # + sudo reboot; + fi; diff --git a/clone/utility/sats-loop b/clone/utility/sats-loop index d4c8b47..8949646 100644 --- a/clone/utility/sats-loop +++ b/clone/utility/sats-loop @@ -3,16 +3,13 @@ # [0] Exit if no argument test $# -lt 1 && exit; -# [1] first install (install source code) -sh /home/sats/satsd/install-source 2> /home/sats/satsd/log/install-source.log > /home/sats/satsd/log/install-source.log; - - -# [2] Propagate script +# [1] Propagate script to DAEMON if [ "$1" = "daemon" ]; then sh /home/sats/satsd/source/daemon 2>> /home/sats/satsd/log/daemon.log >> /home/sats/satsd/log/daemon.log; +# [2] Propagate script to UPDATE elif [ "$1" = "update" ]; then sh /home/sats/satsd/source/update 2>> /home/sats/satsd/log/update.log >> /home/sats/satsd/log/update.log;