From f3bf095e9f4d5e225549b4683d583ed21c2ad6da Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 29 Aug 2016 11:28:49 +0100 Subject: [PATCH] Update script only applies to mesh --- src/freedombone-app-tahoelafs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index 5a4facfd..640a5c7f 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -206,9 +206,9 @@ function configure_firewall_for_tahoelafs { function tahoelafs_update_script { update_script_filename=$1 - update_script_type=$2 echo '#!/bin/bash' > $update_script_filename + echo 'TOX_USERNAME=$(toxid --showuser)' >> $update_script_filename echo 'PEERS_FILE=$(mktemp /tmp/tahoelafs-peers.XXXXXX)' >> $update_script_filename echo -n 'avahi-browse -atl | grep "Workstation" | ' >> $update_script_filename echo -n "awk -F ' ' '{print \$4}' " >> $update_script_filename @@ -242,19 +242,10 @@ function tahoelafs_update_script { echo ' if [ -f /home/$USERNAME/.tahoe/tahoe.cfg ]; then' >> $update_script_filename echo ' if ! grep -q "introducer.furl = ${furl}" /home/$USERNAME/.tahoe/tahoe.cfg; then' >> $update_script_filename echo ' sed -i "s|introducer.furl =.*|introducer.furl = ${furl}|g" /home/$USERNAME/.tahoe/tahoe.cfg' >> $update_script_filename - - # change the nickname to the same as used by tox - if [ $update_script_type ]; then - if [[ $update_script_type == "mesh" ]]; then - echo ' TOX_USERNAME=$(toxid --showuser)' >> $update_script_filename - echo ' sed -i "s|nickname =.*|nickname = ${TOX_USERNAME}|g" /home/$USERNAME/.tahoe/tahoe.cfg' >> $update_script_filename - fi - fi - + echo ' sed -i "s|nickname =.*|nickname = ${TOX_USERNAME}|g" /home/$USERNAME/.tahoe/tahoe.cfg' >> $update_script_filename echo ' chown $USERNAME:$USERNAME /home/$USERNAME/.tahoe/tahoe.cfg' >> $update_script_filename echo " su -c '$TAHOE_COMMAND restart' - \$USERNAME" >> $update_script_filename echo ' fi' >> $update_script_filename - echo ' fi' >> $update_script_filename echo 'done' >> $update_script_filename echo '' >> $update_script_filename @@ -280,7 +271,7 @@ EOF chroot "$rootdir" /root/install_tahoelafs chroot "$rootdir" rm /root/install_tahoelafs - tahoelafs_update_script $rootdir/usr/bin/update-tahoelafs mesh + tahoelafs_update_script $rootdir/usr/bin/update-tahoelafs if ! grep -q "update-tahoelafs" $rootdir/etc/crontab; then echo "*/1 * * * * root /usr/bin/update-tahoelafs 2> /dev/null" >> $rootdir/etc/crontab