pandora-first-run-wizard: Added reboot instead of set up now.
[openpandora.oe.git] / recipes / pandora-system / pandora-first-run-wizard / first-run-wizard.sh
old mode 100644 (file)
new mode 100755 (executable)
index 32180cb..e7d6842
@@ -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,7 +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 for use.\n\nDo you want to setup your unit now or shutdown the unit and do it later?" --ok-label="Start now" --cancel-label="Shutdown" ; then
 
 # ----
 
@@ -45,19 +46,19 @@ fi
 
 # Ask the user to calibrate the touchscreen.
 
-if zenity --question --title="Touchscreen calibration" --text="It is recommended to calibrate and test the device touchscreen.\n\nDo you wish to calibrate the touchscreen now?" --ok-label="Yes" --cancel-label="No"; then 
-       # Make sure we have a sane environment as this script will be run long before any /etc/profile stuff.
-       . /etc/profile.d/tslib.sh
-       # Delete the pointercal file (do we want to do that?)
-       # rm /etc/pointercal
-       # Spawn the ts_* tools as subprocesses that will return to the script.
-       echo Running ts_calibrate       
-       /usr/bin/ts_calibrate
-       wait
-       echo Running ts_test
-       /usr/bin/ts_test
-       wait
-fi
+#if zenity --question --title="Touchscreen calibration" --text="It is recommended to calibrate and test the device touchscreen.\n\nDo you wish to calibrate the touchscreen now?" --ok-label="Yes" --cancel-label="No"; then 
+#      # Make sure we have a sane environment as this script will be run long before any /etc/profile stuff.
+#      . /etc/profile.d/tslib.sh
+#      # Delete the pointercal file (do we want to do that?)
+#      # rm /etc/pointercal
+#      # Spawn the ts_* tools as subprocesses that will return to the script.
+#      echo Running ts_calibrate       
+#      /usr/bin/ts_calibrate
+#      wait
+#      echo Running ts_test
+#      /usr/bin/ts_test
+#      wait
+#fi
 
 # ----
 
@@ -86,7 +87,7 @@ while ! username=$(zenity --title="Enter your username" --entry --text "Please c
        zenity --title="Error" --error --text="Please try again." --timeout 6
 done
 
-while ! useradd -c "$name,,," -G adm,audio,video,netdev,wheel,plugdev "$username" ; do
+while ! useradd -c "$name,,," -G adm,audio,video,netdev,wheel,plugdev,users "$username" ; do
        username=$(zenity --title="Please check username" --entry --text "Please ensure that your username consists of only\nletters and numbers and is not already in use on the system." --entry-text "$username")
 done
 
@@ -146,26 +147,30 @@ 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
-done
+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 "select defaultgui" )
+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}')
 
-if [ $launcher == "xfce" ]; then 
-       sed -i 's/.*sessions.*/sessions xfce4,pmenu/g' /etc/slim.conf
-       echo Xfce selected as default interface
+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
-       echo PMenu selected as default interface
+  sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' /home/$username/.xinitrc
 fi
 
 # ----
 
 # Set the timezone and date/time
 
-while ! timezone=$(zenity --list --title "Select your timezone" --text="Please select your timezone" --column="Select your timezone" --print-column=1 "GMT" "GMT+1" "GMT+2" "GMT+3" "GMT+4" "GMT+5" "GMT+6" "GMT+7" "GMT+8" "GMT+9" "GMT+10" "GMT+11" "GMT+12" "GMT-1" "GMT-2" "GMT-3" "GMT-4" "GMT-5" "GMT-6" "GMT-7" "GMT-8" "GMT-9" "GMT-10" "GMT-11" "GMT-12" "GMT-13" "GMT-14" "UCT" "UTC" "Universal" --width=250 --height=450) || [ "x$timezone" = "x" ] ; do
+while ! timezone=$(zenity --list --title "Select your timezone" --text="Please select your timezone" --column="Select your timezone" --print-column=1 "GMT (London, Lisbon, Portugal, Casablanca, Morocco)" "GMT+1 (Paris, Berlin, Amsterdam, Bern, Stockholm)" "GMT+2 (Athens, Helsinki, Istanbul)" "GMT+3 (Kuwait, Nairobi, Riyadh, Moscow)" "GMT+4 (Abu Dhabi, Iraq, Muscat, Kabul)" "GMT+5 (Calcutta, Colombo, Islamabad, Madras, New Delhi)" "GMT+6 (Almaty, Dhakar, Kathmandu)" "GMT+7 (Bangkok, Hanoi, Jakarta)" "GMT+8 (Beijing, Hong Kong, Kuala Lumpar, Singapore, Taipei)" "GMT+9 (Osaka, Seoul, Sapporo, Tokyo, Yakutsk)" "GMT+10 (Brisbane, Melbourne, Sydney, Vladivostok)" "GMT+11 (Magadan, New Caledonia, Solomon Is)" "GMT+12 (Auckland, Fiji, Kamchatka, Marshall Is., Wellington, Suva)" "GMT-1 (Azores, Cape Verde Is.)" "GMT-2 (Mid-Atlantic)" "GMT-3 (Brasilia, Buenos Aires, Georgetown)" "GMT-4 (Atlantic Time, Caracas)" "GMT-5 (Bogota, Lima, New York)" "GMT-6 (Mexico City, Saskatchewan, Chicago, Guatamala)" "GMT-7 (Denver, Edmonton, Mountain Time, Phoenix, Salt Lake City)" "GMT-8 (Anchorage, Los Angeles, San Francisco, Seattle)" "GMT-9 (Alaska)" "GMT-10 (Hawaii, Honolulu)" "GMT-11 (Midway Island, Samoa)" "GMT-12 (Eniwetok, Kwaialein)" "UTC" "Universal" --width=500 --height=450) || [ "x$timezone" = "x" ] ; do
        zenity --title="Error" --error --text="Please select a timezone." --timeout=6
 done
-
+timezone=`echo $timezone | sed  's/(.*)//g'`
 echo $timezone
 echo rm /etc/localtime && ln -s /usr/share/zoneinfo/Etc/$timezone /etc/localtime
 
@@ -210,3 +215,6 @@ touch /etc/pandora/first-boot
 chmod 0666 /etc/pandora/first-boot
 
 # ----
+else
+poweroff
+fi
\ No newline at end of file