pandora-scripts: try to fix currentuser/home mess
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_startupmanager.sh
index 17e5e71..dafede2 100755 (executable)
@@ -3,6 +3,10 @@
 # Startup-Manager, v1.1, written by Michael Mrozek aka EvilDragon 2010 with some help by vimacs.
 # This scripts allows you to change various settings of the Pandora startup process.
 
+. /usr/pandora/scripts/op_common.sh
+user2=$(get_user)
+user2_home=$(get_user_home)
+
 while mainsel=$(zenity --title="Startup manager" --width="400" --height="310" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the Startup Settings\n\nHere you can change the default boot-up behaviour of your Pandora.\n\nWhat do you want to do?\n" "gui" "Change Default GUI for current user" "login" "Enable/Disable auto login" "user" "Select default user" "service" "Enable/Disable services on boot" --ok-label="Change Setting" --cancel-label="Exit"); do
 
 
@@ -10,7 +14,6 @@ case $mainsel in
 
 # Change default GUI
   "gui")
-    user2=$(cat /tmp/currentuser)
     selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change the default GUI" --list --column "Name" --column "Description" --text "Please select the GUI you want to run as default startup" )
 
     echo $selection
@@ -18,7 +21,7 @@ case $mainsel in
     gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
 
     if [ $gui ]; then 
-      sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" /home/$user2/.xinitrc
+      sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" $user2_home/.xinitrc
       zenity --info --title="Changed session" --text "The default session has been changed to $selection." --timeout 6
     fi;;
 
@@ -66,4 +69,4 @@ case $mainsel in
        done
 ;;
 esac
-done 
\ No newline at end of file
+done