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 # Don't install any configuration. This will be a base system
if [[ $VARIANT != "mesh" ]]; then if [[ $VARIANT != "mesh" ]]; then
CONFIG_FILENAME= CONFIG_FILENAME=
else
touch $rootdir/root/.initial_mesh_setup
fi fi
# The presence of this file indicates that the initial # The presence of this file indicates that the initial
@ -292,7 +294,7 @@ EOF
echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
fi fi
else else
echo " ${PROJECT_NAME}-image-mesh" >> $rootdir/root/.bashrc echo 'echo ""'
fi fi
echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
@ -359,6 +361,32 @@ atheros_wifi() {
fi 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 # Set to true/false to control if eatmydata is used during build
use_eatmydata=true use_eatmydata=true
@ -470,6 +498,7 @@ admin_user_sudo
create_generic_image create_generic_image
atheros_wifi atheros_wifi
continue_installation continue_installation
initialise_mesh
cd / cd /
echo $"info: killing leftover processes in chroot" echo $"info: killing leftover processes in chroot"

View File

@ -290,6 +290,7 @@ function configure_tox {
fi fi
} }
if [ -f /root/.initial_mesh_setup ]; then
if [ $1 ]; then if [ $1 ]; then
MY_USERNAME=$1 MY_USERNAME=$1
fi fi
@ -301,4 +302,10 @@ configure_zeronet_forum
configure_tox configure_tox
change_avahi_name change_avahi_name
rm /root/.initial_mesh_setup
systemctl disable mesh-setup.service
touch /root/.mesh_setup_completed
reboot
fi
exit 0 exit 0