op_defaultgui.sh: Changed so it uses a config file for the GUI.
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_defaultgui.sh
old mode 100644 (file)
new mode 100755 (executable)
index 7407acb..3eaa905
@@ -1,41 +1,16 @@
-#!/bin/sh
+#!/bin/bash
 
-# Set the correct user for Autologin and enable / disable it.
+selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change he Default GUI" --list --multiple --column "Name" --column "Description" --text "Please select the GUI you want to run as default startup" )
+echo $selection
 
-if zenity --question --title="Autologin" --text="Do you wish to automatically login at startup?\n\nSecurity warning: This skips the password check on startup" --ok-label="Yes" --cancel-label="No"; then              
-       # echo "PREFERED_USER=$username" > /etc/default/autologin
-       sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
-       sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf
-else
-       if zenity --question --title="User" --text="Do you wish to have your username automatically populated in the login screen?\n\nNote: This is ideal if your the only user of the OpenPandora but wish to disable autologin and use a password." --ok-label="Yes" --cancel-label="No"; then 
-               sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
-               sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
-       else
-               sed -i "s/.*default_user.*/default_user/g" /etc/slim.conf
-               sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
-       fi
-fi
-
-# ----
-
-# Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc
+gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
 
-while ! launcher=$(zenity --height 260 --list --title="Default User Interface" --text="Please choose your default application launcher.\n\nYou can always change this setting later." --column "return" --print-column=1 --hide-column=1 --column "Pick a launcher" "xfce" "Desktop environment (Xfce)" "mmenu" "A very basic GUI (MiniMenu)" "pmenu" "Gaming-console like launcher (PMenu)" "netbooklauncher" "Ubuntu Netbook Launcher") || [ "x$launcher" = "x" ]; do 
-       zenity --title="Error" --error --text="Please select a default launcher." --timeout 6
-done
+echo $gui
 
-if [ $launcher == "xfce" ]; then 
-#      sed -i 's/.*sessions .*/sessions xfce4,pmenu/g' /etc/slim.conf
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' ~/.xinitrc
-       echo Xfce selected as default interface
-elif [ $launcher == "pmenu" ]; then
-#      sed -i 's/.*sessions .*/sessions pmenu,xfce4/g' /etc/slim.conf
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=pmenu/g' ~/.xinitrc
-       echo PMenu selected as default interface
-elif [ $launcher == "netbooklauncher" ]; then
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startnetbooklauncher/g' ~/.xinitrc
-elif [ $launcher == "mmenu" ]; then
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startmmenu/g' ~/.xinitrc
-fi
-
-zenity --info --title="Changed session" --text "Thankyou, the default session has been changed." --timeout 6
+if [ $gui ]; then 
+  sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" ~/.xinitrc
+  echo $selection selected as default interface
+  zenity --info --title="Changed session" --text "Thank you, the default session has been changed to $selection." --timeout 6
+else
+  exit 0
+fi
\ No newline at end of file