[bigupdate] (1) sats-sync.target is now a service because Assertion wasn't working so added an ExecStart that does the same (2) Added sats-sync-stop path and service to stop sats-sync target (now service) when the file changes (3) Fixed in `sats-install` script an echo to a `slog` (step 8)
This commit is contained in:
parent
def9d80334
commit
cca5071ac3
52
clone/clone
52
clone/clone
|
@ -334,26 +334,36 @@ step7(){
|
|||
sudo cp ./utility/sats-loop.service /mnt/lib/systemd/system/sats-loop.service;
|
||||
|
||||
# (5) Create sats-sync target #
|
||||
echo " (.) Create sats-sync target";
|
||||
echo " (.) Create sats-sync target (service)";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-sync.target /mnt/lib/systemd/system/sats-sync.target
|
||||
sudo cp ./utility/sats-sync.service /mnt/lib/systemd/system/sats-sync.service;
|
||||
|
||||
# (6) Create sats-sync path #
|
||||
# (6) Create sats-sync-stop service #
|
||||
echo " (.) Create sats-sync-stop service";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-sync-stop.service /mnt/lib/systemd/system/sats-sync-stop.service;
|
||||
|
||||
# (7) Create sats-sync path #
|
||||
echo " (.) Create sats-sync path";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-sync.path /mnt/lib/systemd/system/sats-sync.path;
|
||||
|
||||
# (7) Create sats-update timer #
|
||||
# (8) Create sats-sync-stop path #
|
||||
echo " (.) Create sats-sync-stop path";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-sync-stop.path /mnt/lib/systemd/system/sats-sync-stop.path;
|
||||
|
||||
# (9) Create sats-update timer #
|
||||
echo " (.) Create sats-update timer";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-update.timer /mnt/lib/systemd/system/sats-update.timer;
|
||||
|
||||
# (8) Create sats-dwc@ service #
|
||||
# (10) Create sats-dwc@ service #
|
||||
echo " (.) Create sats-dwc@ service";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/sats-dwc@.service /mnt/lib/systemd/system/sats-dwc@.service;
|
||||
|
||||
# (9) Create firewall@ service #
|
||||
# (11) Create firewall@ service #
|
||||
echo " (.) Create firewall@ service";
|
||||
echo " - /lib/systemd/system";
|
||||
sudo cp ./utility/firewall@.service /mnt/lib/systemd/system/firewall@.service;
|
||||
|
@ -368,19 +378,23 @@ step7(){
|
|||
echo " (.) Emulate \`systemctl enable sats-loop.service\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-loop.service /mnt/etc/systemd/system/multi-user.target.wants/sats-loop.service;
|
||||
|
||||
# (3) Enable sats-sync path at startup #
|
||||
echo " (.) Emulate \`systemctl enable sats-sync.path\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-sync.path /mnt/etc/systemd/system/multi-user.target.wants/sats-sync.path;
|
||||
|
||||
# (4) Enable sats-update timer at startup #
|
||||
# (3) Enable sats-update timer at startup #
|
||||
echo " (.) Emulate \`systemctl enable sats-update.timer\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-update.timer /mnt/etc/systemd/system/multi-user.target.wants/sats-update.timer;
|
||||
|
||||
# (5) Enable sats-dwc@wlan0 at startup #
|
||||
# (4) Enable sats-sync path at startup #
|
||||
echo " (.) Emulate \`systemctl enable sats-sync.path\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-sync.path /mnt/etc/systemd/system/multi-user.target.wants/sats-sync.path;
|
||||
|
||||
# (5) Enable sats-sync-stop path at startup #
|
||||
echo " (.) Emulate \`systemctl enable sats-sync-stop.path\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-sync-stop.path /mnt/etc/systemd/system/multi-user.target.wants/sats-sync-stop.path;
|
||||
|
||||
# (6) Enable sats-dwc@wlan0 at startup #
|
||||
echo " (.) Emulate \`systemctl enable sats-dwc@wlan0.service\`";
|
||||
sudo ln -fs /lib/systemd/system/sats-dwc@.service /mnt/etc/systemd/system/multi-user.target.wants/sats-dwc@wlan0.service;
|
||||
|
||||
# (6) Enable firewall@default at startup #
|
||||
# (7) Enable firewall@default at startup #
|
||||
echo " (.) Emulate \`systemctl enable firewall@default.service\`";
|
||||
sudo ln -fs /lib/systemd/system/firewall@.service /mnt/etc/systemd/system/multi-user.target.wants/firewall@default.service;
|
||||
|
||||
|
@ -403,11 +417,15 @@ step7(){
|
|||
echo " (.) Create sats-loop script";
|
||||
cat ./utility/sats-loop | sudo tee /mnt/service/sats-loop > /dev/null;
|
||||
|
||||
# (5) Create sats-dwc@wlan0 script #
|
||||
# (5) Create sats-sync-stop script #
|
||||
echo " (.) Create sats-sync-stop script";
|
||||
cat ./utility/sats-sync-stop | sudo tee /mnt/service/sats-sync-stop > /dev/null;
|
||||
|
||||
# (6) Create sats-dwc@wlan0 script #
|
||||
echo " (.) Create sats-dwc@wlan0 script";
|
||||
cat ./utility/wlan0.dwc | sed "s/\*\*\*SALT\*\*\*/$WIFI_SALT/" | sed "s/\*\*\*PEPPER\*\*\*/$WIFI_PEPPER/" | sudo tee /mnt/etc/wpa_supplicant/wlan0.dwc > /dev/null;
|
||||
|
||||
# (6) Create firewall@default script #
|
||||
# (7) Create firewall@default script #
|
||||
echo " (.) Create firewall@default script";
|
||||
sudo mkdir -p /mnt/opt/firewall;
|
||||
cat ./utility/default.fw | sudo tee /mnt/opt/firewall/default.fw > /dev/null;
|
||||
|
@ -425,7 +443,7 @@ step7(){
|
|||
# (2) target dir #
|
||||
echo " - /target (sats:pi 750)";
|
||||
sudo chown -R 666:1000 /mnt/target;
|
||||
sudo chmod -R 750 /mnt/target;
|
||||
sudo chmod -R 755 /mnt/target;
|
||||
|
||||
echo "<<< done";
|
||||
|
||||
|
@ -553,6 +571,7 @@ echo "(6) Manage ssh keys";
|
|||
echo "(7) Set up systemd background";
|
||||
echo "(8) Set up WiFi config";
|
||||
echo "(9) Set up SATS daemon";
|
||||
echo "(10) Proper finishing";
|
||||
read -p "step: " step;
|
||||
|
||||
case $step in
|
||||
|
@ -565,5 +584,6 @@ case $step in
|
|||
"7") step7;;
|
||||
"8") step8;;
|
||||
"9") step9;;
|
||||
"10") step10;;
|
||||
*) echo "wrong step"; exit;;
|
||||
esac;
|
||||
|
|
|
@ -66,7 +66,7 @@ fi;
|
|||
|
||||
|
||||
# (2) Enable SPI device #
|
||||
echo " * 8. Enabling 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 \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Unit]
|
||||
Description=[::SATS::] Daemon
|
||||
Requires=sats-sync.target
|
||||
After=sats-sync.target
|
||||
Requires=sats-sync.service
|
||||
After=sats-sync.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo -u sats test ! -e /target/sync && sudo systemctl stop sats-sync.service;
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=[::SATS::] Path watcher (stop)
|
||||
|
||||
[Path]
|
||||
PathModified=/target/sync
|
||||
Unit=sats-sync-stop.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=[::SATS::] Sync target (stop)
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
User=pi
|
||||
Group=pi
|
||||
|
||||
ExecStart=/bin/bash /service/sats-sync-stop
|
|
@ -3,7 +3,7 @@ Description=[::SATS::] Path watcher
|
|||
|
||||
[Path]
|
||||
PathExists=/target/sync
|
||||
Unit=sats-sync.target
|
||||
Unit=sats-sync.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -4,3 +4,11 @@ Requires=sats-boot.service
|
|||
Wants=sats-install.service
|
||||
After=sats-boot.service sats-install.service
|
||||
AssertPathExists=/target/sync
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
User=sats
|
||||
Group=sats
|
||||
|
||||
ExecStart=/usr/sbin/test -e /target/sync
|
|
@ -2,7 +2,7 @@
|
|||
Description=[::SATS::] Update Process
|
||||
Requires=sats-dwc@wlan0.service network-online.target
|
||||
After=sats-dwc@wlan0.service
|
||||
Requisite=sats-sync.target
|
||||
Requisite=sats-sync.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
|
Loading…
Reference in New Issue