Set username on first boot of mesh client
This commit is contained in:
parent
a8007caadc
commit
44ad7ff678
|
@ -577,6 +577,7 @@ function mesh_client_startup_applications {
|
|||
fi
|
||||
|
||||
START_DESKTOP=$rootdir/home/$MY_USERNAME/mesh-desktop.sh
|
||||
FIRST_BOOT=/home/$MY_USERNAME/.first_boot
|
||||
echo '#!/bin/bash' > $START_DESKTOP
|
||||
echo 'dconf write /org/mate/caja/desktop/volumes-visible false' >> $START_DESKTOP
|
||||
echo 'dconf write /org/mate/caja/desktop/computer-icon-visible false' >> $START_DESKTOP
|
||||
|
@ -590,6 +591,35 @@ function mesh_client_startup_applications {
|
|||
echo "chmod 600 /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
echo "env | grep DBUS_SESSION_BUS_ADDRESS > /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
echo "echo 'export DBUS_SESSION_BUS_ADDRESS' >> /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
|
||||
echo '' >> $START_DESKTOP
|
||||
echo "if [ ! -f $FIRST_BOOT ]; then" >> $START_DESKTOP
|
||||
echo ' exit 0' >> $START_DESKTOP
|
||||
echo 'fi' >> $START_DESKTOP
|
||||
echo '' >> $START_DESKTOP
|
||||
echo 'INITIAL_TOX_USERNAME=' >> $START_DESKTOP
|
||||
echo 'while [ ! $INITIAL_TOX_USERNAME ]; do' >> $START_DESKTOP
|
||||
echo ' data=$(tempfile 2>/dev/null)' >> $START_DESKTOP
|
||||
echo ' trap "rm -f $data" 0 1 2 5 15' >> $START_DESKTOP
|
||||
echo ' dialog --title $"Freedombone Mesh" \' >> $START_DESKTOP
|
||||
echo ' --backtitle $"Freedombone Mesh" \' >> $START_DESKTOP
|
||||
echo ' --inputbox $"\nWelcome to the Freedombone mesh.\n\nThe first thing you will need to do is set a username so that other peers can find you." 12 60 "Anon" 2>$data' >> $START_DESKTOP
|
||||
echo ' sel=$?' >> $START_DESKTOP
|
||||
echo ' case $sel in' >> $START_DESKTOP
|
||||
echo ' 0)' >> $START_DESKTOP
|
||||
echo ' INITIAL_TOX_USERNAME=$(<$data)' >> $START_DESKTOP
|
||||
echo ' if [ ${#INITIAL_TOX_USERNAME} -lt 1 ]; then' >> $START_DESKTOP
|
||||
echo ' INITIAL_TOX_USERNAME=' >> $START_DESKTOP
|
||||
echo ' fi' >> $START_DESKTOP
|
||||
echo ' ;;' >> $START_DESKTOP
|
||||
echo ' esac' >> $START_DESKTOP
|
||||
echo 'done' >> $START_DESKTOP
|
||||
echo '' >> $START_DESKTOP
|
||||
echo 'toxid --setuser "$INITIAL_TOX_USERNAME"' >> $START_DESKTOP
|
||||
echo '' >> $START_DESKTOP
|
||||
echo "rm -f $FIRST_BOOT" >> $START_DESKTOP
|
||||
echo '' >> $START_DESKTOP
|
||||
echo 'exit 0' >> $START_DESKTOP
|
||||
chmod +x $START_DESKTOP
|
||||
|
||||
START_DESKTOP2=$rootdir/home/$MY_USERNAME/.config/autostart/mesh-start.desktop
|
||||
|
|
|
@ -54,6 +54,7 @@ MESH_INSTALL_DIR=/var/lib
|
|||
MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
|
||||
MESH_INSTALL_SETUP=/root/.initial_mesh_setup
|
||||
MESH_AMNESIC=/root/.amnesic
|
||||
FIRST_BOOT=/home/$MY_USERNAME/.first_boot
|
||||
|
||||
# Tomb containing logs
|
||||
TOMB_LOG_SIZE_MB=10
|
||||
|
@ -820,6 +821,10 @@ if [ -f $MESH_INSTALL_SETUP ]; then
|
|||
if [ ! -f $MESH_INSTALL_COMPLETED ]; then
|
||||
echo $'Mesh node setup complete' >> $INSTALL_LOG
|
||||
touch $MESH_INSTALL_COMPLETED
|
||||
if [ -d /home/$MY_USERNAME/Desktop ]; then
|
||||
touch $FIRST_BOOT
|
||||
chown ${MY_USERNAME}:${MY_USERNAME} $FIRST_BOOT
|
||||
fi
|
||||
reboot
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue