first-run-wizard: Fixed the fix. I really need to get some sleep :(
[openpandora.oe.git] / recipes / pandora-system / pandora-first-run-wizard / first-run-wizard.sh
old mode 100644 (file)
new mode 100755 (executable)
index dba1324..48a922f
@@ -7,6 +7,7 @@
 
 export LANG=en_GB.UTF-8
 export GTK2_RC_FILES=/usr/share/themes/Xfce/gtk-2.0/gtkrc
+xmodmap /etc/skel/.pndXmodmap
 
 # Ensure there is a wheel group for sudoers to be put into.
 # TODO: Do this somewhere better.
@@ -23,8 +24,7 @@ RESET_ROOT="yes"
 
 # Greet the user.
 
-zenity --info --title="Pandoras Box has been opened." --text="Welcome!\n\nPandora's Box has been opened.\n\nThis wizard will help you setting up your new OpenPandora handheld before the first use.\n\nYou will be asked a few simple questions to personalise and configure your device for use." --timeout 45
-
+if zenity --question --title="Pandoras Box has been opened." --text="Welcome!\n\nPandora's Box has been opened.\n\nThis wizard will help you setting up your new OpenPandora handheld before the first use.\n\nYou will be asked a few simple questions to personalise and configure your device.\n\nDo you want to set up your unit now or shut the unit down and do it later?" --ok-label="Start now" --cancel-label="Shutdown" ; then
 # ----
 
 # Reset ROOT's password to something random 
@@ -118,10 +118,13 @@ EOF
 
 # Pick a name for the OpenPandora.
 
-while ! hostname=$(zenity --title="Name your Pandora" --entry --text "Please choose a name for your OpenPandora.\n\nIt should only contain letters, numbers and dashes." --entry-text "$username-openpandora") || [ "x$hostname" = "x" ]; do 
+while ! hostname=$(zenity --title="Name your Pandora" --entry --text "Please choose a name for your OpenPandora.\n\nIt should only contain letters, numbers and dashes, no spaces." --entry-text "$username-openpandora") || [ "x$hostname" = "x" ]; do 
        zenity --title="Error" --error --text="Please try again."
 done
 
+
+echo $hostname > /etc/hostname
+hostname =$(sed 's/ /_/g' /etc/hostname)
 echo $hostname > /etc/hostname
 echo "127.0.0.1 localhost.localdomain localhost $hostname" > /etc/hosts
 hostname -F /etc/hostname
@@ -133,7 +136,7 @@ if zenity --question --title="Autologin" --text="Do you wish to automatically lo
        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 
+       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 you're 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
@@ -146,18 +149,27 @@ fi
 
 # Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc
 
-while ! launcher=$(zenity --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)" "pmenu" "Gaming-console like launcher (PMenu)") || [ "x$launcher" = "x" ]; do 
-       zenity --title="Error" --error --text="Please select a default launcher." --timeout 6
+selection=""
+while [ x$selection = x ]; do
+selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Select the Default GUI" --list --column "Name" --column "Description" --text "Please select the Default GUI" )
+if [ x$selection = x ]; then
+  zenity --title="Error" --error --text="Please select a GUI." --timeout=6
+fi
 done
 
-if [ $launcher == "xfce" ]; then 
-#      sed -i 's/.*sessions .*/sessions xfce4,pmenu/g' /etc/slim.conf
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' /home/$username/.xinitrc
-       echo Xfce selected as default interface
+echo $selection
+
+gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
+stopcommand=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $4}')
+
+echo $gui
+
+if [ $gui ]; then 
+  sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" /home/$username/.xinitrc
+  echo $selection selected as default interface
+  zenity --info --title="Selected session" --text "You selected $selection as default setting. You can always change your default GUI later." --timeout 6
 else
-#      sed -i 's/.*sessions .*/sessions pmenu,xfce4/g' /etc/slim.conf
-       sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=pmenu/g' /home/$username/.xinitrc
-       echo PMenu selected as default interface
+  sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' /home/$username/.xinitrc
 fi
 
 # ----
@@ -204,6 +216,20 @@ zenity --info --title="Finished" --text "This concludes the First Boot Wizard.\n
 
 # ----
 
+# NOTE: This is just a temporary fix! These daemons should be removed from startup in the OE recipes. Until the time is found, we'll do it from here.
+update-rc.d -f samba remove
+update-rc.d -f xinetd remove
+update-rc.d -f avahi-daemon remove
+update-rc.d -f apmd remove
+update-rc.d -f usb-gadget remove
+update-rc.d -f banner remove
+update-rc.d -f portmap remove
+update-rc.d -f mountnfs remove
+update-rc.d -f blueprobe remove
+update-rc.d -f dropbear remove
+update-rc.d -f wl1251-init remove
+
+
 # Write the control file so this script is not run on next boot 
 # (hackish I know but I want the flexability to drop a new script in later esp. in the early firmwares).
 
@@ -212,3 +238,6 @@ touch /etc/pandora/first-boot
 chmod 0666 /etc/pandora/first-boot
 
 # ----
+else
+poweroff
+fi
\ No newline at end of file