[Fixed] SPI python lib installation management

This commit is contained in:
xdrm-brackets 2017-02-17 17:07:39 +01:00
parent acff04903a
commit 24c1e8471d
3 changed files with 20 additions and 13 deletions

View File

@ -324,7 +324,7 @@ step9(){
sudo mkdir -p /mnt/home/sats/satsd/conf; sudo mkdir -p /mnt/home/sats/satsd/conf;
sudo mkdir -p /mnt/home/sats/satsd/data; sudo mkdir -p /mnt/home/sats/satsd/data;
sudo mkdir -p /mnt/home/sats/satsd/tmp; sudo mkdir -p /mnt/home/sats/satsd/tmp;
sudo touch /mnt/home/sats/satsd/first_install; sudo touch /mnt/home/sats/satsd/first_boot;
# (2) Create default configuration files # # (2) Create default configuration files #
echo " (.) Create default configuration/log files"; echo " (.) Create default configuration/log files";

View File

@ -2,7 +2,7 @@
# [1] First install only # [1] First install only
#========================================================# #========================================================#
if [ -e /home/sats/satsd/first_install ]; then if [ -e /home/sats/satsd/first_boot ]; then
dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0;
@ -12,21 +12,12 @@ if [ -e /home/sats/satsd/first_install ]; then
if [ $gitinstalled -eq 1 ]; then if [ $gitinstalled -eq 1 ]; then
git clone -b $BRANCH ssh://smmp-server/satsd/git /home/sats/satsd/source \ git clone -b $BRANCH ssh://smmp-server/satsd/git /home/sats/satsd/source \
&& rm /home/sats/satsd/first_install \ && rm /home/sats/satsd/first_boot \
|| exit; || exit;
fi; fi;
# (2) Reboot to activate SPI #
# (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; sudo reboot;
fi; fi;

View File

@ -14,3 +14,19 @@ sudo systemctl start ssh;
# [4] Try to install necessary packages # [4] Try to install necessary packages
sudo apt-get update; sudo apt-get update;
sudo apt-get -y install git php5 php5-cli php5-curl python-dev; 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
# [5] 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 #
sudo git clone https://github.com/lthiery/SPI-Py.git /home/pi/spi-lib;
sudo python /home/pi/spi-lib/setup.py install;
fi;