pandora-first-run-wizard: add hack to remove unneeded /media dirs
[openpandora.oe.git] / recipes / pandora-system / pandora-first-run-wizard / first-run-wizard.sh
index 256f995..a801e3f 100755 (executable)
@@ -133,7 +133,7 @@ hostname -F /etc/hostname
 
 # Set the correct user for Autologin and enable / disable it.
 
-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              
+if zenity --question --title="Autologin" --text="If you like, you can setup your Pandora to autologin into the system at startup.\nWhile this is more convenient for most users, it features a potential security issue, as no password will be needed to access your desktop and personal files.\n\nDo you wish to automatically login at 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
@@ -153,7 +153,7 @@ fi
 
 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" )
+selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=310 --title="Select the Default GUI" --list --column "Name" --column "Description" --text "You can now select your preferred GUI - the GUI that will be loaded automatically on startup of the unit.\n\nYou can either select XFCE4, which is a full desktop environment (similar to a normal PC).\nOr you could select MiniMenu, which is a minimal UI similar to gaming devices.\n\nIf you select the last choice (GUISwitch), you will be prompted to choose a GUI each time you boot your Pandora.\n\nThis setting can always be changed later by running the Startup-Settings." )
 if [ x$selection = x ]; then
   zenity --title="Error" --error --text="Please select a GUI." --timeout=6
 fi
@@ -169,7 +169,7 @@ 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
+  zenity --info --title="Selected session" --text "You selected $selection as default setting." --timeout 6
 else
   sed -i 's/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=startxfce4/g' /home/$username/.xinitrc
 fi
@@ -203,12 +203,12 @@ echo $date
 time_h=`date +%H`
 time_m=`date +%M`
 
-while ! time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM):" --entry-text "$time_h:$time_m") || [ "x$time" = "x" ] ; do
+while ! time=$(zenity --title="Enter current time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m") || [ "x$time" = "x" ] ; do
         zenity --title="Error" --error --text="Please input the time." --timeout 6
 done
 
 while ! date -d $time ; do
-       time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM):" --entry-text "$time_h:$time_m")
+       time=$(zenity --title="Enter current time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m")
 done
  
 date +%Y%m%d -s $date
@@ -216,12 +216,6 @@ date +%H:%M -s $time
 
 # ----
 
-# Finsh up and boot the system.
-
-zenity --info --title="Finished" --text "This concludes the First Boot Wizard.\n\nYour chosen interface will start in a few seconds\n\nThankyou for buying the OpenPandora. Enjoy using the device!" --timeout 6
-
-# ----
-
 # 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
@@ -235,6 +229,8 @@ update-rc.d -f blueprobe remove
 update-rc.d -f dropbear remove
 update-rc.d -f wl1251-init remove
 
+# get rid of some dirs in /media that OE creates but are unlikely to be used
+rmdir /media/card /media/cf /media/mmc1 /media/net /media/realroot /media/union 2> /dev/null
 
 # 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).
@@ -243,7 +239,32 @@ touch /etc/pandora/first-boot
 # Make the control file writeable by all to allow the user to delete to rerun the wizard on next boot.
 chmod 0666 /etc/pandora/first-boot
 
+
+# Let the user run optional config stuff.
+
+while mainsel=$(zenity --title="Optional settings" --width="400" --height="300" --list --column "id" --column "Please select" --hide-column=1 --text="This concludes the mandatory part of the First Boot Wizard.\n\nYou can now either continue to boot the system or change some more settings.\n\n\nThank you for buying the OpenPandora. Enjoy using the device." "speed" "CPU-Speed and Overclocking-Settings" "startup" "Startup-Settings" "lcd" "LCD-Settings" --ok-label="Change selected Setting" --cancel-label="Continue to Boot"); do
+
+case $mainsel in
+  "speed")
+  /usr/pandora/scripts/op_cpusettings.sh
+  ;;
+
+   "startup")
+  echo $username > /tmp/currentuser
+  /usr/pandora/scripts/op_startupmanager.sh
+  ;;
+
+   "lcd")
+  /usr/pandora/scripts/op_lcdsettings.sh
+  ;;
+
+esac
+done
+
+# ----
+
+
 # ----
 else
 poweroff
-fi
\ No newline at end of file
+fi