From acff04903abab9009e213ba3b555ed319fa04d07 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 17 Feb 2017 16:50:12 +0100 Subject: [PATCH] Manage python lib installation + spi activation --- clone/clone | 20 ++++++++++++++++++-- clone/clone.conf | 4 ++++ clone/utility/install-source | 19 ++++++++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/clone/clone b/clone/clone index 3776e89..2ee6dea 100755 --- a/clone/clone +++ b/clone/clone @@ -98,8 +98,23 @@ step3(){ test $confirm_burn != "y" && echo "<<< aborting" && exit; # (2) Burning image into disk # - ( dd if=./original.img | pv -s $(du -bs ./original.img | awk '{print $1}') | sudo dd of=$DEV bs=4M ) \ - || $( echo "<<< error: dd command failed" && exit ); + # if GZIP + if [ "IMAGE_ZIP" = "1" ]; then + + + echo " - using gunzip"; + + ( dd if=$IMAGE_FILE | pv -s $(du -bs $IMAGE_FILE | gunzip | awk '{print $1}') | sudo dd of=$DEV bs=4M ) \ + || $( echo "<<< error: dd command failed" && exit ); + + else + + ( dd if=$IMAGE_FILE | pv -s $(du -bs $IMAGE_FILE | awk '{print $1}') | sudo dd of=$DEV bs=4M ) \ + || $( echo "<<< error: dd command failed" && exit ); + + + fi; + echo "<<< done"; @@ -308,6 +323,7 @@ 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_install; # (2) Create default configuration files # diff --git a/clone/clone.conf b/clone/clone.conf index 562f0bd..25d10ce 100755 --- a/clone/clone.conf +++ b/clone/clone.conf @@ -1,5 +1,9 @@ #!/bin/sh +# DEBIAN IMAGE FILE +export IMAGE_FILE="original.img"; +export IMAGE_GZIP="0"; + # WIFI SETTINGS export WIFI_SSID="freeboxma"; export WIFI_PASS=" manon adrien "; diff --git a/clone/utility/install-source b/clone/utility/install-source index 62d8d93..72f2361 100644 --- a/clone/utility/install-source +++ b/clone/utility/install-source @@ -15,13 +15,18 @@ if [ -e /home/sats/satsd/first_install ]; then && rm /home/sats/satsd/first_install \ || exit; - # (2) Without git installed # - else - - # temporary replacement (without git) - scp -r smmp-server:/satsd/scp/$BRANCH/source /home/sats/satsd/ \ - && rm /home/sats/satsd/first_install \ - || 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; + + # (3) Clone SPI python library # + sudo git clone https://github.com/lthiery/SPI-Py.git /home/sats/satsd/spi-lib; + sudo python /home/sats/satsd/spi-lib/setup.py install; + + # (4) Reboot to activate SPI # + sudo reboot; + fi;