updated services
This commit is contained in:
parent
052bd68ea0
commit
e88f8e3089
|
@ -32,6 +32,15 @@ echo "pi password changed" | sudo -u sats tee -a /home/sats/satsd/log/install.lo
|
||||||
################################################
|
################################################
|
||||||
if [ ! -e /target/install ]; then
|
if [ ! -e /target/install ]; then
|
||||||
|
|
||||||
|
# (1) If no network -> exit #
|
||||||
|
if [ $(systemctl is-active network-online.target) != "active" ]; then
|
||||||
|
echo "not connection, rebooting" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
|
exit 127;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
# [1] Installation
|
||||||
|
#========================================================#
|
||||||
# (1) Try to install necessary packages
|
# (1) Try to install necessary packages
|
||||||
sudo apt-get update;
|
sudo apt-get update;
|
||||||
echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
|
@ -70,9 +79,24 @@ if [ ! -e /target/install ]; then
|
||||||
sudo python setup.py install;
|
sudo python setup.py install;
|
||||||
echo "Built SPI-Py lib" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
echo "Built SPI-Py lib" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
|
|
||||||
# (4) Reboot to activate SPI #
|
|
||||||
sudo -u sats touch /target/install;
|
# [2] Synchronization
|
||||||
echo "Created target file" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
#========================================================#
|
||||||
|
# (1) Exports #
|
||||||
|
__DIR__=/home/sats/satsd/source;
|
||||||
|
|
||||||
|
source $__DIR__/lib/include/bash/const;
|
||||||
|
source $__DIR__/lib/include/bash/func;
|
||||||
|
|
||||||
|
# (2) Process sync #
|
||||||
|
echo "Synchronization" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
|
test "$($SOURCE_DIR/lib/api/sync)" = "127" && slog "sync failed" - "install" && exit 127;
|
||||||
|
|
||||||
|
sudo -u sats touch /target/sync;
|
||||||
|
echo "Created target file 'sync'" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
|
|
||||||
|
|
||||||
|
# (3) Reboot to activate SPI #
|
||||||
echo "Launching first reboot" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
echo "Launching first reboot" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
|
||||||
sudo reboot;
|
sudo reboot;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=SATS Install Process
|
Description=SATS Install Process
|
||||||
Requires=network-online.target
|
Requires=network.target network-online.target
|
||||||
After=network-online.target network.target
|
After=network.target network-online.target
|
||||||
Before=sats-loop.service
|
Before=sats-loop.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
@ -9,7 +9,4 @@ Type=oneshot
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
User=pi
|
User=pi
|
||||||
Group=pi
|
Group=pi
|
||||||
ExecStart=/bin/sh /service/sats-install
|
ExecStart=/bin/bash /service/sats-install
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,7 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=SATS Daemon
|
Description=SATS Daemon
|
||||||
Wants=sats-install.service
|
Requires=sats-install.service
|
||||||
OnFailure=sats-update.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=SATS Update Process
|
Description=SATS Update Process
|
||||||
Requires=network-online.target network.target
|
Requires=network.target network-online.target
|
||||||
OnFailure=sats-install.service
|
OnFailure=sats-install.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=SATS DWC (Dynamic Wireless Credentials)
|
||||||
|
Requires=sats-install.service
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=sats
|
||||||
|
Group=sats
|
||||||
|
ExecStart=/bin/sh /service/sats-loop
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue