Quellcode durchsuchen

Script for shutting down the mesh

Bob Mottram vor 7 Jahren
Ursprung
Commit
741ef6f7c9
1 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen
  1. 16
    0
      src/freedombone-image-customise

+ 16
- 0
src/freedombone-image-customise Datei anzeigen

@@ -639,6 +639,21 @@ EOF
639 639
     cp $rootdir/root/$PROJECT_NAME/img/icon_ferment.png $rootdir/etc/patchwork/icon_ferment.png
640 640
 }
641 641
 
642
+mesh_shutdown_script() {
643
+    echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
644
+    echo 'Description=Shuts down the mesh' >> $rootdir/etc/systemd/system/meshshutdown.service
645
+    echo 'Before=shutdown.target' >> $rootdir/etc/systemd/system/meshshutdown.service
646
+    echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
647
+    echo '[Service]' >> $rootdir/etc/systemd/system/meshshutdown.service
648
+    echo 'ExecStart=/bin/true' >> $rootdir/etc/systemd/system/meshshutdown.service
649
+    echo 'ExecStop=/bin/bash /usr/local/bin/batman stop' >> $rootdir/etc/systemd/system/meshshutdown.service
650
+    echo 'RemainAfterExit=yes' >> $rootdir/etc/systemd/system/meshshutdown.service
651
+    echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
652
+    echo '[Install]' >> $rootdir/etc/systemd/system/meshshutdown.service
653
+    echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/meshshutdown.service
654
+    chroot "$rootdir" systemctl enable meshshutdown
655
+}
656
+
642 657
 initialise_mesh() {
643 658
     if [[ $VARIANT != "mesh"* ]]; then
644 659
         return
@@ -672,6 +687,7 @@ initialise_mesh() {
672 687
     configure_firewall
673 688
     install_avahi
674 689
     install_batman
690
+    mesh_shutdown_script
675 691
     install_vpn
676 692
     install_tomb
677 693
     #install_tahoelafs