This commit is contained in:
Bob Mottram 2018-01-16 13:27:10 +00:00
commit be89e042c9
3 changed files with 64 additions and 2 deletions

View File

@ -125,6 +125,9 @@ ENABLE_ZERONET=
MESH_TEXT_EDITOR='pluma' MESH_TEXT_EDITOR='pluma'
OLSR2_REPO="https://github.com/OLSR/OONF"
OLSR2_COMMIT='81033251c4ee1c5699bfee9d2985112c6266ab0a'
BMX6_REPO="https://github.com/bmx-routing/bmx6" BMX6_REPO="https://github.com/bmx-routing/bmx6"
BMX6_COMMIT='39dd1f2d99ac5a3fa28e92f8173c15039132e181' BMX6_COMMIT='39dd1f2d99ac5a3fa28e92f8173c15039132e181'
@ -668,6 +671,48 @@ mesh_shutdown_script() {
chroot "$rootdir" systemctl enable meshshutdown chroot "$rootdir" systemctl enable meshshutdown
} }
install_olsr2() {
chroot "$rootdir" apt-get -yq install cmake libnl-3-dev
git clone $OLSR2_REPO $rootdir/etc/olsr2
cat <<EOF > $rootdir/usr/bin/install_olsr2
#!/bin/bash
cd /etc/olsr2
git checkout $OLSR2_COMMIT -b $OLSR2_COMMIT
cd /etc/olsr2/build
cmake ..
make
make install
EOF
chroot "$rootdir" chmod +x /usr/bin/install_olsr2
chroot "$rootdir" /usr/bin/install_olsr2
if [ ! -f $rootdir/usr/local/sbin/olsrd2_static ]; then
echo $'Unable to build OLSR2'
exit 79835392
fi
rm $rootdir/usr/bin/install_olsr2
echo '[Unit]' > $rootdir/etc/systemd/system/olsr2.service
echo 'Description=OLSR2 mesh routing protocol' >> $rootdir/etc/systemd/system/olsr2.service
echo 'Requires=network.target' >> $rootdir/etc/systemd/system/olsr2.service
echo 'After=network.target' >> $rootdir/etc/systemd/system/olsr2.service
echo '' >> $rootdir/etc/systemd/system/olsr2.service
echo '[Service]' >> $rootdir/etc/systemd/system/olsr2.service
echo 'Type=forking' >> $rootdir/etc/systemd/system/olsr2.service
echo 'User=root' >> $rootdir/etc/systemd/system/olsr2.service
echo 'Group=root' >> $rootdir/etc/systemd/system/olsr2.service
echo 'ExecStart=/usr/local/sbin/olsrd2_static wlan0' >> $rootdir/etc/systemd/system/olsr2.service
echo 'ExecStop=/usr/bin/kill -15 $MAINPID' >> $rootdir/etc/systemd/system/olsr2.service
echo 'PIDFile=/var/run/olsr2/pid' >> $rootdir/etc/systemd/system/olsr2.service
echo 'Restart=on-failure' >> $rootdir/etc/systemd/system/olsr2.service
echo '' >> $rootdir/etc/systemd/system/olsr2.service
echo '[Install]' >> $rootdir/etc/systemd/system/olsr2.service
echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/olsr2.service
}
install_bmx6() { install_bmx6() {
git clone $BMX6_REPO $rootdir/etc/bmx6 git clone $BMX6_REPO $rootdir/etc/bmx6
@ -853,6 +898,7 @@ initialise_mesh() {
install_batman install_batman
install_bmx6 install_bmx6
install_bmx7 install_bmx7
install_olsr2
mesh_shutdown_script mesh_shutdown_script
install_vpn install_vpn
install_tomb install_tomb

View File

@ -1423,6 +1423,10 @@ if [ -f $MESH_INSTALL_SETUP ]; then
systemctl disable bmx7 systemctl disable bmx7
echo $'BMX7 disabled' >> $INSTALL_LOG echo $'BMX7 disabled' >> $INSTALL_LOG
systemctl stop olsr2
systemctl disable olsr2
echo $'OLSR2 disabled' >> $INSTALL_LOG
#tomb slam all #tomb slam all
tmp_ram_disk 100 tmp_ram_disk 100
enable_predictable_device_names enable_predictable_device_names

View File

@ -54,7 +54,8 @@ function status {
if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
bmx6 -c show=originators bmx6 -c show=originators
else fi
if grep -q "bmx7" $MESH_CURRENT_PROTOCOL; then
bmx7 -c show=originators bmx7 -c show=originators
fi fi
} }
@ -71,8 +72,10 @@ function stop {
systemctl stop bmx6 systemctl stop bmx6
systemctl stop bmx7 systemctl stop bmx7
systemctl stop olsr2
systemctl disable bmx6 systemctl disable bmx6
systemctl disable bmx7 systemctl disable bmx7
systemctl disable olsr2
systemctl stop dnsmasq systemctl stop dnsmasq
systemctl disable dnsmasq systemctl disable dnsmasq
@ -206,6 +209,7 @@ function start {
sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE}|g" /etc/systemd/system/bmx6.service sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE}|g" /etc/systemd/system/bmx6.service
sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE}|g" /etc/systemd/system/bmx7.service sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE}|g" /etc/systemd/system/bmx7.service
sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE}|g" /etc/systemd/system/olsr2.service
systemctl daemon-reload systemctl daemon-reload
add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
@ -229,6 +233,7 @@ function start {
sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service
sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service
sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE} ${EIFACE}|g" /etc/systemd/system/olsr2.service
systemctl daemon-reload systemctl daemon-reload
else else
echo $"$EIFACE is not connected" echo $"$EIFACE is not connected"
@ -255,11 +260,18 @@ function start {
if grep -q "bmx6" $MESH_DEFAULT_PROTOCOL; then if grep -q "bmx6" $MESH_DEFAULT_PROTOCOL; then
systemctl enable bmx6 systemctl enable bmx6
systemctl restart bmx6 systemctl restart bmx6
else fi
if grep -q "bmx7" $MESH_DEFAULT_PROTOCOL; then
systemctl enable bmx7 systemctl enable bmx7
systemctl restart bmx7 systemctl restart bmx7
fi fi
if grep -q "olsr" $MESH_DEFAULT_PROTOCOL; then
systemctl enable olsr2
systemctl restart olsr2
fi
systemctl restart avahi-daemon systemctl restart avahi-daemon
verify verify