From: David-John Willis Date: Tue, 17 Nov 2009 12:18:37 +0000 (+0000) Subject: pandora-first-run-wizard: Update script to add a background to the X window. X-Git-Tag: Release-2010-05/1~169 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff_plain;h=478e357a3ad07bd3e56697d3864dffd5bf4633e9;hp=f6fab330a977ee65feac9b59b3c8430be16d977f;ds=sidebyside pandora-first-run-wizard: Update script to add a background to the X window. * Temp background - Move to a branding package. --- diff --git a/recipes/pandora-system/pandora-first-run-wizard.bb b/recipes/pandora-system/pandora-first-run-wizard.bb index 0a05310..d2a9adb 100755 --- a/recipes/pandora-system/pandora-first-run-wizard.bb +++ b/recipes/pandora-system/pandora-first-run-wizard.bb @@ -1,22 +1,33 @@ DESCRIPTION = "Scripts to support the first run wizard on the OpenPandora." LICENSE = "GPLV2" -RDEPENDS = "pandora-auto-startx zenity dbus" - -# Based on the scripts by JohnX/Mer Project - http://wiki.maemo.org/Mer/ +RDEPENDS = "hsetroot zenity dbus" COMPATIBLE_MACHINE = "omap3-pandora" -PR = "r1" +PR = "r2" SRC_URI = " \ - file://first-boot-wizard.sh \ + file://first-run-wizard.sh \ + file://rc.firstrun \ + file://op_default.png \ " +inherit update-rc.d + +INITSCRIPT_NAME = "oprun-init" +INITSCRIPT_PARAMS = "start 29 2 3 4 5 . stop 29 2 3 4 5 ." + do_install() { - install -d ${D}${sbindir} - cp -pP ${WORKDIR}/first-boot-wizard.sh ${D}${sbindir}/first-boot-wizard.sh + install -d ${D}${prefix}/pandora/scripts/ + install -m 0755 ${WORKDIR}/first-run-wizard.sh ${D}${prefix}/pandora/scripts/ + + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/rc.firstrun ${D}${sysconfdir}/init.d/oprun-init + + install -d ${D}${datadir}/backgrounds/ + install -m 0644 ${WORKDIR}/op_default.png ${D}${datadir}/backgrounds/ } PACKAGE_ARCH = "${MACHINE_ARCH}" -FILES_${PN} += "/lib/firmware" +FILES_${PN} += "${prefix} ${sysconfdir}" diff --git a/recipes/pandora-system/pandora-first-run-wizard/first-run-wizard.sh b/recipes/pandora-system/pandora-first-run-wizard/first-run-wizard.sh new file mode 100644 index 0000000..27a393d --- /dev/null +++ b/recipes/pandora-system/pandora-first-run-wizard/first-run-wizard.sh @@ -0,0 +1,111 @@ +#!/bin/sh + +# Based on the scripts by JohnX/Mer Project - http://wiki.maemo.org/Mer/ +# Reworked for the OpenPandora - John Willis/Michael Mrozek + +# You can start the wizard from the shell using 'xinit ./first-boot-init.sh' +# Maybe we run it for the first time from rc5.d and delete the symlink at the end of the script? + +export LANG=en_GB.UTF-8 +export GTK2_RC_FILES=/usr/share/themes/Xfce/gtk-2.0/gtkrc + +# We will load up a background image here as soon as we have a tool for that :) +WALLPAPER=`/usr/share/backgrounds/op_default.png` +hsetroot -center $WALLPAPER + +# Greet the user +zenity --info --title="Pandoras Box has been opened." --text "Welcome. This Wizard will help you setting up your Pandora before your first use." + +# Should we really enable SWAP? +#swap_part=$(sfdisk -l /dev/mmcblk? | grep swap | cut -d" " -f1) +#if [ x$swap_part != x ] ; then +# 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") +# if [ "$use_swap" = "Use swap on $swap_part" ] ; then +# swapon $swap_part +# echo "$swap_part none swap sw 0 0" >> /etc/fstab +# fi +#fi + +# First, setup the full name and username. + +while ! name=$(zenity --title="Enter your name" --entry --text "Please enter your full name.") || [ "x$name" = "x" ] ; do + zenity --title="Error" --error --text="Please try again." +done + +username_guess=$(echo "$name" | cut -d" " -f1 | tr A-Z a-z) + +while ! username=$(zenity --title="Enter your username" --entry --text "Please choose a short username. +It should be all lowercase and +contain only letters and numbers." --entry-text "$username_guess") || [ "x$username" = "x" ] ; do + zenity --title="Error" --error --text="Please try again." +done + +# Note: Group wheel doesn't exist in the current image! Should be created for easy sudo! + +while ! useradd -c "$name,,," -G adm,audio,video,netdev,wheel,plugdev "$username" ; do + username=$(zenity --title="Please check username" --entry --text "Please be sure that your +username consists of only +letters and numbers." --entry-text "$username") +done + +# Password setup. + +password="" +while [ x$password = x ] ; do + password1=$(zenity --title=Password --entry --text="Choose a new password." --hide-text) + password2=$(zenity --title=Confirm --entry --text="Confirm your new password." --hide-text) + if [ $password1 != $password2 ] ; then + zenity --title="Error" --error --text="Passwords don't match. +Please try again." + else if [ x$password1 = x ] ; then + zenity --title="Error" --error --text="Password can't be blank! +Please try again." + else + password=$password1 + fi + fi +done + +# Setting the password doesn't work yet (permission issues) + +passwd "$username" < /etc/hostname +echo "127.0.0.1 localhost.localdomain localhost $hostname" > /etc/hosts +#cat /usr/share/first-boot-wizard/hosts-template >> /etc/hosts +hostname -F /etc/hostname + + +# Set the correct user for Autologin and enable / disable it. + +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 + # 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 + else + sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf +fi + +# I don't know yet how to setup which GUI will run as default. At the moment, it just creates a small file and puts XFCE or cpasjuste into it :) + +if zenity --question --title="Default GUI" --text="Now you can choose whether you want to boot into a full desktop or a gaming console-like launcher as default.\n\nYou can always change that setting later." --ok-label="Full Desktop (XFCE)" --cancel-label="Gaming +console-like Launcher"; then + echo XFCE > /etc/bootup.cfg + else + echo cpasjuste > /etc/bootup.cfg +fi + +zenity --info --title="Finished" --text "This concludes the First Boot Wizard.\nThanks for buying the Pandora. Enjoy the device!" + diff --git a/recipes/pandora-system/pandora-first-run-wizard/op_default.png b/recipes/pandora-system/pandora-first-run-wizard/op_default.png new file mode 100644 index 0000000..74675c7 Binary files /dev/null and b/recipes/pandora-system/pandora-first-run-wizard/op_default.png differ diff --git a/recipes/pandora-system/pandora-first-run-wizard/rc.firstrun b/recipes/pandora-system/pandora-first-run-wizard/rc.firstrun new file mode 100644 index 0000000..1f4b42c --- /dev/null +++ b/recipes/pandora-system/pandora-first-run-wizard/rc.firstrun @@ -0,0 +1,73 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: opruninit +# Required-Start: #adjust +# Required-Stop: #adjust +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +DESC="OpenPandora First Run Deamon" +NAME="opruninit" + +PID=`pidof -o %PPID -x first-run-wizard.sh` +OPRUNINIT='xinit /usr/pandora/first-run-wizard.sh' + +d_stop() { + if [ $PID ] + then + kill $PID + else + echo "$DESC: $NAME not running." + fi +} + +d_start() { + if [ $PID ] + then + echo "$DESC: $NAME already running." + else + $OPRUNINIT -d 3 + fi +} + +d_reload() { + if [ $PID ] + then + kill -HUP $PID + else + echo "$DESC: $NAME not running." + fi +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + reload) + echo -n "Reloading $DESC: $NAME" + d_reload + echo "." + ;; + restart|force-reload) + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0