[1] Now /boot operations made here (not in sats-install anymore)

[2] Now 'pi' runs sats-feature@ to avoid permission issues
This commit is contained in:
xdrm-brackets 2017-10-02 15:44:08 +02:00
parent 5ff281d99d
commit 9797c939d3
5 changed files with 23 additions and 19 deletions

View File

@ -177,8 +177,20 @@ step4(){
exit 1;
fi;
# [1] Mount device partition
sudo mount ${DEV}2 /mnt || (echo "<<< error: can't mount"; exit 1);
# (1) Disable ipv6 in the sd@1 partition #
echo " * Configuring /boot in ${DEV}1 partition";
sudo mount ${DEV}1 /mnt || (echo "<<< error: can't mount ${DEV}1"; exit 1);
echo "ipv6.disable=1" | sudo tee -a /mnt/cmdline.txt > /dev/null;
echo " * Enabling spi device";
echo "dtparam=spi=on" | sudo tee -a /mnt/config.txt > /dev/null;
echo "dtoverlay=spi-bcm2708" | sudo tee -a /mnt/config.txt > /dev/null;
echo " > done";
sudo umount /mnt;
# (2) Mount main partition #
sudo mount ${DEV}2 /mnt || (echo "<<< error: can't mount ${DEV}2"; exit 1);
echo "<<< done";

View File

@ -16,4 +16,5 @@ iface eth0 inet manual
# wifi network interface #1
allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up iwconfig wlan0 power off
dns-nameservers 8.8.8.8 8.8.4.4

View File

@ -5,8 +5,8 @@ After=sats-sync.service
[Service]
Type=simple
User=sats
Group=sats
User=pi
Group=pi
ExecStart=/bin/bash /home/sats/satsd/source/feature/%i/main
[Install]

View File

@ -72,17 +72,8 @@ sudo -u sats git clone -b $BRANCH ssh://smmp-server/satsd/git /home/sats/satsd/s
|| failexit;
# (2) Enable SPI device #
slog " * 8. Enabling spi device";
echo "dtparam=spi=on" | sudo tee -a /boot/config.txt > /dev/null \
|| failexit;
echo "dtoverlay=spi-bcm2708" | sudo tee -a /boot/config.txt > /dev/null \
|| failexit;
slog " > done";
# (3) Clone SPI python library #
slog " * 9. Cloning 'SPI-Py' lib";
slog " * 8. Cloning 'SPI-Py' lib";
if [ -d /home/pi/spi-lib ]; then
slog " > done (already cloned)";
else
@ -92,7 +83,7 @@ else
fi;
# (4) Install SPI python library #
slog " * 10. Installing 'SPI-Py' lib into the system";
slog " * 9. Installing 'SPI-Py' lib into the system";
cd /home/pi/spi-lib;
sudo python setup.py build \
|| failexit;
@ -104,17 +95,17 @@ slog " > done";
# [2] Synchronization
#========================================================#
# (1) Process sync #
slog " * 11. Synchronizing the SATS with SMMP's server";
slog " * 10. Synchronizing the SATS with SMMP's server";
test "$(sudo -u sats /home/sats/satsd/source/lib/api/sync)" = "0" \
&& slog " > done" \
|| failexit;
# (2) Create target file #
slog " * 12. Creating target file 'sync'";
slog " * 11. Creating target file 'sync'";
sudo -u sats touch /target/sync \
&& slog " > done" \
|| failexit;
# (3) Reboot to activate SPI #
slog " * 13. Launching first reboot";
slog " * 12. Launching first reboot";
sudo reboot;

View File

@ -68,7 +68,7 @@ slog "[`date +%s`] > done";
# [4] Update 'wpa_supplicant' configuration
#========================================================#
echo -e "network={\n\tssid=\"SATS_$AP_HASH\"\n\tpsk=\"$PASS\"\n}" | sudo tee /etc/wpa_supplicant/$IFACE.conf;
echo -e "ctrl_interface=/var/run/wpa_supplicant\n\nnetwork={\n\tssid=\"SATS_$AP_HASH\"\n\tpsk=\"$PASS\"\n}" | sudo tee /etc/wpa_supplicant/$IFACE.conf;
# [5] Restart connection