Beginning of amnesic mesh

This commit is contained in:
Bob Mottram 2016-07-22 08:29:17 +01:00
parent f8c28d5183
commit 1e626eb44d
1 changed files with 29 additions and 0 deletions

View File

@ -50,6 +50,7 @@ TOX_NODES=
MESH_INSTALL_DIR=/var/lib
MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
MESH_INSTALL_SETUP=/root/.initial_mesh_setup
MESH_AMNESIC=/root/.amnesic
function set_hostname {
DEFAULT_DOMAIN_NAME="$1"
@ -525,6 +526,33 @@ function enable_batman_daemon {
systemctl daemon-reload
}
function mesh_amnesic {
if [ ! -f $MESH_AMNESIC ]; then
if [ -f /etc/systemd/system/amnesic.service ]; then
systemctl disable amnesic
fi
return
fi
if [ ! -f /etc/systemd/system/amnesic.service ]; then
echo '[Unit]' > /etc/systemd/system/amnesic.service
echo 'Description=Amnesic Mesh' >> /etc/systemd/system/amnesic.service
echo '' >> /etc/systemd/system/amnesic.service
echo '[Service]' >> /etc/systemd/system/amnesic.service
echo 'Type=oneshot' >> /etc/systemd/system/amnesic.service
echo 'RemainAfterExit=true' >> /etc/systemd/system/amnesic.service
echo 'ExecStart=/bin/true' >> /etc/systemd/system/amnesic.service
echo 'ExecStop=TODO' >> /etc/systemd/system/amnesic.service
echo '' >> /etc/systemd/system/amnesic.service
echo '[Install]' >> /etc/systemd/system/amnesic.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/amnesic.service
systemctl daemon-reload
fi
systemctl enable amnesic
systemctl start amnesic
}
# whether to reset the identity
if [ $2 ]; then
if [[ "$2" == $"new"* ]]; then
@ -559,6 +587,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
configure_zeronet
disable_password_logins
disable_screen_lock
mesh_amnesic
rm $MESH_INSTALL_SETUP
systemctl disable mesh-setup.service