3 # Based on the scripts by JohnX/Mer Project - http://wiki.maemo.org/Mer/
4 # Reworked for the OpenPandora - John Willis/Michael Mrozek
6 # You can start the wizard from the shell using 'xinit ./first-boot-init.sh'
7 # Maybe we run it for the first time from rc5.d and delete the symlink at the end of the script?
9 export LANG=en_GB.UTF-8
10 export GTK2_RC_FILES=/usr/share/themes/Xfce/gtk-2.0/gtkrc
12 # Ensure there is a wheel group for sudoers to be put into.
13 # TODO: Do this somewhere better.
16 # We load up a background image here
17 export WALLPAPER=/usr/share/xfce4/backdrops/op-firstrun.png
18 hsetroot -center $WALLPAPER
21 zenity --info --title="Pandoras Box has been opened." --text "Welcome. This wizard will help you setting up your new OpenPandora handheld before the first use."
23 # Calibrate touchscreen?
24 if zenity --question --title="Touchscreen calibration" --text="It is recommended to calibrate the devices touchscreen./nDo you wish to calibrate your touchscreen now?" --ok-label="Calibrate" --cancel-label="Do not calibrate"; then
25 # Make sure we have a sane environment as this script will be run long before any /etc/profile stuff.
26 . /etc/profile.d/tslib.sh
31 # Should we really enable SWAP?
32 #swap_part=$(sfdisk -l /dev/mmcblk? | grep swap | cut -d" " -f1)
33 #if [ x$swap_part != x ] ; then
34 # use_swap=$(zenity --title="Enable swap?" --text "Swap partition found. Would you like to use it?" --list --radiolist --column " " --column "Answer" TRUE "Use swap on $swap_part" FALSE "Do not use swap")
35 # if [ "$use_swap" = "Use swap on $swap_part" ] ; then
37 # echo "$swap_part none swap sw 0 0" >> /etc/fstab
41 # First, setup the full name and username.
43 while ! name=$(zenity --title="Enter your name" --entry --text "Please enter your full name.") || [ "x$name" = "x" ] ; do
44 zenity --title="Error" --error --text="Please try again."
47 username_guess=$(echo "$name" | cut -d" " -f1 | tr A-Z a-z)
49 while ! username=$(zenity --title="Enter your username" --entry --text "Please choose a short username.
50 It should be all lowercase and
51 contain only letters and numbers." --entry-text "$username_guess") || [ "x$username" = "x" ] ; do
52 zenity --title="Error" --error --text="Please try again."
55 while ! useradd -c "$name,,," -G adm,audio,video,netdev,wheel,plugdev "$username" ; do
56 username=$(zenity --title="Please check username" --entry --text "Please be sure that your
57 username consists of only
58 letters and numbers." --entry-text "$username")
61 sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
66 while [ x$password = x ] ; do
67 password1=$(zenity --title=Password --entry --text="Choose a new password." --hide-text)
68 password2=$(zenity --title=Confirm --entry --text="Confirm your new password." --hide-text)
69 if [ $password1 != $password2 ] ; then
70 zenity --title="Error" --error --text="Passwords don't match.
72 else if [ x$password1 = x ] ; then
73 zenity --title="Error" --error --text="Password can not be blank!
81 passwd "$username" <<EOF
86 # Name our little baby
88 while ! hostname=$(zenity --title="Name your Pandora" --entry --text "Please choose a name for
89 your Pandora. It should only contain
90 letters, numbers and dashes." --entry-text "$username-pandora") || [ "x$hostname" = "x" ]; do
91 zenity --title="Error" --error --text="Please try again."
94 echo $hostname > /etc/hostname
95 echo "127.0.0.1 localhost.localdomain localhost $hostname" > /etc/hosts
96 #cat /usr/share/first-boot-wizard/hosts-template >> /etc/hosts
97 hostname -F /etc/hostname
100 # Set the correct user for Autologin and enable / disable it.
102 if zenity --question --title="Autologin" --text="Do you want to automatically login on startup?\n\nSecurity warning: This skips the password check on startup" --ok-label="Yes, enable Autologin" --cancel-label="Do not enable Autologin"; then
103 # echo "PREFERED_USER=$username" > /etc/default/autologin
104 sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf
106 sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf
109 # Change the default session in SLiM.
111 if zenity --question --title="Default Inteface" --text="Now you can choose whether you want to boot into a full desktop interface or a gaming console-like launcher by default.\n\nYou can always change this setting later." --ok-label="Full Desktop (Xfce)" --cancel-label="Games console like Launcher (PMenu)"; then
112 echo Xfce4 > /etc/bootup.cfg
113 sed -i 's/.*sessions.*/sessions xfce4,pmenu/g' /etc/slim.conf
115 echo PMenu > /etc/bootup.cfg
116 sed -i 's/.*sessions.*/sessions pmenu,xfce4/g' /etc/slim.conf
119 zenity --info --title="Finished" --text "This concludes the First Boot Wizard.\nThanks for buying the OpenPandora. Enjoy the device!"