Mesh router setup

This commit is contained in:
Bob Mottram 2016-01-11 11:27:08 +00:00
parent 276ef767f1
commit 29bb1348f5
2 changed files with 46 additions and 10 deletions

View File

@ -215,6 +215,8 @@ create_generic_image() {
# Don't install any configuration. This will be a base system
if [[ $VARIANT != "mesh" ]]; then
CONFIG_FILENAME=
else
touch $rootdir/root/.initial_mesh_setup
fi
# The presence of this file indicates that the initial
@ -292,7 +294,7 @@ EOF
echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
fi
else
echo " ${PROJECT_NAME}-image-mesh" >> $rootdir/root/.bashrc
echo 'echo ""'
fi
echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
@ -359,6 +361,32 @@ atheros_wifi() {
fi
}
initialise_mesh() {
if [[ $VARIANT != "mesh" ]]; then
return
fi
MESH_SERVICE='mesh-setup.service'
MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE
echo '[Unit]' > $MESH_SETUP_DAEMON
echo 'Description=Initial mesh router configuration' >> $MESH_SETUP_DAEMON
echo 'After=syslog.target' >> $MESH_SETUP_DAEMON
echo 'After=network.target' >> $MESH_SETUP_DAEMON
echo '[Service]' >> $MESH_SETUP_DAEMON
echo 'Type=simple' >> $MESH_SETUP_DAEMON
echo 'User=root' >> $MESH_SETUP_DAEMON
echo 'Group=root' >> $MESH_SETUP_DAEMON
echo 'WorkingDirectory=/root' >> $MESH_SETUP_DAEMON
echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-image-mesh > /var/log/mesh-setup.log" >> $MESH_SETUP_DAEMON
echo '' >> $MESH_SETUP_DAEMON
echo 'TimeoutSec=99999' >> $MESH_SETUP_DAEMON
echo '' >> $MESH_SETUP_DAEMON
echo '[Install]' >> $MESH_SETUP_DAEMON
echo 'WantedBy=multi-user.target' >> $MESH_SETUP_DAEMON
chroot $rootdir systemctl enable $MESH_SERVICE
}
# Set to true/false to control if eatmydata is used during build
use_eatmydata=true
@ -470,6 +498,7 @@ admin_user_sudo
create_generic_image
atheros_wifi
continue_installation
initialise_mesh
cd /
echo $"info: killing leftover processes in chroot"

View File

@ -290,15 +290,22 @@ function configure_tox {
fi
}
if [ $1 ]; then
MY_USERNAME=$1
if [ -f /root/.initial_mesh_setup ]; then
if [ $1 ]; then
MY_USERNAME=$1
fi
regenerate_ssh_host_keys
configure_zeronet_blog
configure_zeronet_mail
configure_zeronet_forum
configure_tox
change_avahi_name
rm /root/.initial_mesh_setup
systemctl disable mesh-setup.service
touch /root/.mesh_setup_completed
reboot
fi
regenerate_ssh_host_keys
configure_zeronet_blog
configure_zeronet_mail
configure_zeronet_forum
configure_tox
change_avahi_name
exit 0