From 7d02a03a927a001be2ef1a4c55a44327453478c9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 30 Jul 2016 13:12:32 +0100 Subject: [PATCH] Only show desktop icons when ready --- src/freedombone-image-customise | 31 -------------- src/freedombone-image-mesh | 72 ++++++++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 8fca8084..5da647f0 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -575,27 +575,6 @@ function mesh_client_startup_applications { mkdir -p $rootdir/home/$MY_USERNAME/.config/autostart fi - echo '[Desktop Entry]' > $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'Name=Tox Chat' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'Type=Application' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'Comment=Chat, VoIP, Video' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'TryExec=qtox -p data' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'Exec=qtox -p data' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'Icon=qtox' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - echo 'StartupNotify=true' >> $rootdir/home/$MY_USERNAME/Desktop/tox.desktop - - echo '[Desktop Entry]' > $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Version=1.0' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Name=New Identity' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Type=Application' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Comment=Create a new identity' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Exec=mate-terminal -e freedombone-mesh-reset' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Icon=user-away' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Terminal=false' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - echo 'Categories=Application;' >> $rootdir/home/$MY_USERNAME/Desktop/new_identity.desktop - - #cp $rootdir/home/$MY_USERNAME/Desktop/tox.desktop $rootdir/home/$MY_USERNAME/.config/autostart/tox.desktop - chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config } @@ -614,16 +593,6 @@ function mesh_desktop_icons { echo 'Icon=terminal' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop echo 'StartupNotify=true' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop - # browse - echo '[Desktop Entry]' > $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'Name=Mesh' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'Type=Application' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'Comment=Browse the mesh' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'TryExec=meshweb' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'Exec=meshweb' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo "Icon=$BROWSER" >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - echo 'StartupNotify=true' >> $rootdir/home/$MY_USERNAME/Desktop/mesh.desktop - chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop } diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index d5101479..a189c1c9 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -463,6 +463,48 @@ function create_tox_user { toxid -u $MY_USERNAME -n data chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config fi + + if [ ! -d /home/$MY_USERNAME/Desktop ]; then + return + fi + + 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, Video' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'TryExec=qtox -p data' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Exec=qtox -p data' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Icon=qtox' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/tox.desktop + + chown ${MY_DESKTOP}:${MY_DESKTOP} /home/$MY_USERNAME/Desktop/* +} + +function show_desktop_icons { + if [ ! -d /home/$MY_USERNAME/Desktop ]; then + return + fi + + echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'Name=Mesh' >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'Comment=Browse the mesh' >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'TryExec=meshweb' >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'Exec=meshweb' >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo "Icon=$BROWSER" >> /home/$MY_USERNAME/Desktop/mesh.desktop + echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/mesh.desktop + + echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Version=1.0' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Name=New Identity' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Comment=Create a new identity' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Exec=mate-terminal -e freedombone-mesh-reset' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Icon=user-away' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/new_identity.desktop + + chown ${MY_DESKTOP}:${MY_DESKTOP} /home/$MY_USERNAME/Desktop/* } function disable_password_logins { @@ -680,6 +722,20 @@ function setup_amnesic_data { fi } +function setup_dconf { + if [ -d /home/${MY_USERNAME}/Desktop ]; then + PID=$(pgrep gnome-session) + export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) + + dconf write /org/mate/caja/desktop/computer-icon-visible false + dconf write /org/mate/caja/desktop/home-icon-visible false + dconf write /org/mate/caja/desktop/network-icon-visible false + dconf write /org/mate/caja/desktop/trash-icon-visible false + dconf write /org/mate/caja/desktop/volumes-visible false + dconf write /org/mate/desktop/media-handling/automount-open false + fi +} + # whether to reset the identity set_new_identity= if [ $2 ]; then @@ -716,6 +772,8 @@ if [ -f $MESH_INSTALL_SETUP ]; then fi echo $'Beginning mesh node setup' >> $INSTALL_LOG + + setup_dconf tomb slam all enable_batman_daemon create_ram_disk 1 @@ -737,20 +795,12 @@ if [ -f $MESH_INSTALL_SETUP ]; then rm $MESH_INSTALL_SETUP systemctl disable mesh-setup.service else - # kill the MATE file manager which pops up when - # encrypted drives are mounted + + if [ -d /home/${MY_USERNAME}/Desktop ]; then pkill caja fi - if [ -d /home/${MY_USERNAME}/Desktop ]; then - # Remove the Icon from the desktop - dconf write /org/mate/caja/desktop/computer-icon-visible false - dconf write /org/mate/caja/desktop/home-icon-visible false - dconf write /org/mate/caja/desktop/network-icon-visible false - dconf write /org/mate/caja/desktop/trash-icon-visible false - dconf write /org/mate/caja/desktop/volumes-visible false - dconf write /org/mate/desktop/media-handling/automount-open false - fi + show_desktop_icons mesh_restart_daemons if [ ! -f $MESH_INSTALL_COMPLETED ]; then