Only enable scuttlebot on mesh gateways
This commit is contained in:
parent
ecd0706eac
commit
5865f2633d
|
@ -894,6 +894,7 @@ function configure_user_interface {
|
|||
# Produce a text file on the desktop listing users on the mesh
|
||||
cat <<EOF > $rootdir/usr/bin/list-tox-users
|
||||
#!/bin/bash
|
||||
ethernet_connected=$(cat /sys/class/net/eth0/carrier)
|
||||
users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d | uniq)
|
||||
if [ ! \$users_list ]; then
|
||||
no_of_users=0
|
||||
|
@ -1003,6 +1004,26 @@ if [ \$no_of_users -gt 0 ]; then
|
|||
chmod +x /home/$MY_USERNAME/Desktop/tox.desktop
|
||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/tox.desktop
|
||||
fi
|
||||
|
||||
# If ethernet is connected then add the invite icon to help enable
|
||||
# SSB nat traversal
|
||||
if [[ "$ethernet_connected" != "0" ]]; then
|
||||
if [ ! -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
|
||||
echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Version=1.0' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Name=Create Invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Comment=Create an invite for Patchwork or Ferment' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Exec=mate-terminal -e freedombone-mesh-invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Icon=/usr/share/freedombone/avatars/invite.png' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
fi
|
||||
else
|
||||
if [ -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
|
||||
rm /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -f /tmp/Users.txt ]; then
|
||||
rm /tmp/Users.txt
|
||||
|
@ -1031,6 +1052,13 @@ else
|
|||
#fi
|
||||
pkill qtox
|
||||
fi
|
||||
|
||||
# If there is no ethernet then remove the invite icon
|
||||
if [[ "$ethernet_connected" == "0" ]]; then
|
||||
if [ -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
|
||||
rm /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
chroot "$rootdir" /bin/chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users
|
||||
|
|
|
@ -311,16 +311,6 @@ function show_desktop_icons {
|
|||
#echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/audio.desktop
|
||||
#echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/audio.desktop
|
||||
|
||||
#echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Version=1.0' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Name=Create Invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Comment=Create an invite for Patchwork or Ferment' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Exec=mate-terminal -e freedombone-mesh-invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Icon=/usr/share/freedombone/avatars/invite.png' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
#echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/invite.desktop
|
||||
|
||||
# set permissions
|
||||
chmod +x /home/$MY_USERNAME/Desktop/*.desktop
|
||||
chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
|
||||
|
|
|
@ -407,8 +407,13 @@ function start {
|
|||
systemctl restart avahi-daemon
|
||||
|
||||
if [ -f /etc/scuttlebot/.ssb/config ]; then
|
||||
sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
|
||||
systemctl restart scuttlebot
|
||||
ethernet_connected=$(cat /sys/class/net/eth0/carrier)
|
||||
if [[ "$ethernet_connected" != "0" ]]; then
|
||||
sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
|
||||
systemctl restart scuttlebot
|
||||
else
|
||||
systemctl stop scuttlebot
|
||||
fi
|
||||
fi
|
||||
|
||||
verify
|
||||
|
|
Loading…
Reference in New Issue