Script for shutting down the mesh

This commit is contained in:
Bob Mottram 2017-10-02 22:52:44 +01:00
parent 83d62a7af9
commit 741ef6f7c9
1 changed files with 16 additions and 0 deletions

View File

@ -639,6 +639,21 @@ EOF
cp $rootdir/root/$PROJECT_NAME/img/icon_ferment.png $rootdir/etc/patchwork/icon_ferment.png
}
mesh_shutdown_script() {
echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
echo 'Description=Shuts down the mesh' >> $rootdir/etc/systemd/system/meshshutdown.service
echo 'Before=shutdown.target' >> $rootdir/etc/systemd/system/meshshutdown.service
echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
echo '[Service]' >> $rootdir/etc/systemd/system/meshshutdown.service
echo 'ExecStart=/bin/true' >> $rootdir/etc/systemd/system/meshshutdown.service
echo 'ExecStop=/bin/bash /usr/local/bin/batman stop' >> $rootdir/etc/systemd/system/meshshutdown.service
echo 'RemainAfterExit=yes' >> $rootdir/etc/systemd/system/meshshutdown.service
echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
echo '[Install]' >> $rootdir/etc/systemd/system/meshshutdown.service
echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/meshshutdown.service
chroot "$rootdir" systemctl enable meshshutdown
}
initialise_mesh() {
if [[ $VARIANT != "mesh"* ]]; then
return
@ -672,6 +687,7 @@ initialise_mesh() {
configure_firewall
install_avahi
install_batman
mesh_shutdown_script
install_vpn
install_tomb
#install_tahoelafs