From a2e1a98b0b2798956a7fcf858762eb85ae1451ea Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Aug 2016 20:46:43 +0100 Subject: [PATCH] Prevent qtox from being opened more than once --- src/freedombone-image-customise | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 3a1e05ba..2f77570f 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -743,12 +743,20 @@ if [ \$no_of_users -gt 0 ]; then chmod +x /home/$MY_USERNAME/Desktop/Users.desktop chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/Users.desktop - if [ ! -f /home/$MY_USERNAME/Desktop/tox.desktop ]; then + if [ ! -f /home/$MY_USERNAME/runtox ]; then + echo 'qtox_running=\$(ps aux | grep qtox | grep data)' >> /home/$MY_USERNAME/runtox + echo 'if [ \${#qtox_running} -eq 0 ]; then' >> /home/$MY_USERNAME/runtox + echo ' bash -c "qtox -p data"' >> /home/$MY_USERNAME/runtox + echo 'fi' >> /home/$MY_USERNAME/runtox + echo 'exit 0' >> /home/$MY_USERNAME/runtox + chmod +x /home/$MY_USERNAME/runtox + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/runtox + echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/tox.desktop echo 'Name=Tox Chat' >> /home/$MY_USERNAME/Desktop/tox.desktop echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/tox.desktop echo 'Comment=Chat, VoIP and Video' >> /home/$MY_USERNAME/Desktop/tox.desktop - echo "Exec=bash -c 'qtox -p data'" >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Exec=bash /usr/$MY_USERNAME/runtox' >> /home/$MY_USERNAME/Desktop/tox.desktop echo 'Icon=/usr/share/icons/hicolor/32x32/apps/qtox.png' >> /home/$MY_USERNAME/Desktop/tox.desktop echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/tox.desktop chmod +x /home/$MY_USERNAME/Desktop/tox.desktop