Merge branch 'master' of git://git.openpandora.org/openpandora.oe
authorDavid-John Willis <John.Willis@Distant-earth.com>
Mon, 12 Apr 2010 10:05:28 +0000 (11:05 +0100)
committerDavid-John Willis <John.Willis@Distant-earth.com>
Mon, 12 Apr 2010 10:05:28 +0000 (11:05 +0100)
Conflicts:
recipes/tasks/task-pandora-xfce.bb

21 files changed:
recipes/pandora-system/pandora-first-run-wizard.bb
recipes/pandora-system/pandora-first-run-wizard/first-run-wizard.sh
recipes/pandora-system/pandora-lcd-state.bb [new file with mode: 0755]
recipes/pandora-system/pandora-lcd-state/brightness.state [new file with mode: 0644]
recipes/pandora-system/pandora-lcd-state/gamma.state [new file with mode: 0644]
recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state [new file with mode: 0644]
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_bright.desktop
recipes/pandora-system/pandora-scripts/op_calibrate.desktop
recipes/pandora-system/pandora-scripts/op_cpuspeed.desktop
recipes/pandora-system/pandora-scripts/op_datetime.desktop
recipes/pandora-system/pandora-scripts/op_defaultgui.desktop
recipes/pandora-system/pandora-scripts/op_defaultgui.sh
recipes/pandora-system/pandora-scripts/op_switchgui.desktop
recipes/pandora-system/pandora-scripts/op_switchgui.sh
recipes/pandora-system/pandora-scripts/op_usermanager.desktop [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/op_usermanager.sh [new file with mode: 0755]
recipes/pandora-system/pandora-scripts/op_wifi.desktop
recipes/pandora-system/pandora-skel.bb
recipes/pandora-system/pandora-sudoers.bb
recipes/tasks/task-pandora-xfce.bb

index 2781196..01c5415 100755 (executable)
@@ -6,7 +6,7 @@ RDEPENDS = "hsetroot zenity dbus pandora-wallpaper-official tslib tslib-calibrat
 
 COMPATIBLE_MACHINE = "omap3-pandora"
 
-PR = "r11"
+PR = "r12"
 
 SRC_URI = " \
           file://first-run-wizard.sh \
index a7bfb5d..e7e6fd2 100755 (executable)
@@ -147,7 +147,7 @@ fi
 
 # Select the default interface and setup SLiM to pass that as a sesion to ~./.xinitrc
 
-selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Select the Default GUI" --list --multiple --column "name" --column "description" --text "select defaultgui" )
+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}')
diff --git a/recipes/pandora-system/pandora-lcd-state.bb b/recipes/pandora-system/pandora-lcd-state.bb
new file mode 100755 (executable)
index 0000000..87d9bdb
--- /dev/null
@@ -0,0 +1,28 @@
+DESCRIPTION = "Save and restore the brightness and gamma state on shutdown / startup"
+LICENSE = "GPLv2"
+
+COMPATIBLE_MACHINE = "omap3-pandora"
+
+PR = "r0"
+inherit update-rc.d
+
+INITSCRIPT_NAME = "pandora-lcd-state"
+INITSCRIPT_PARAMS = "start 39 S . stop 31 0 1 6 ."
+
+SRC_URI = " \
+          file://rc.pandora-lcd-state \
+         file://gamma.state \
+         file://brightness.state \
+"
+
+do_install() {
+          install -d ${D}${sysconfdir}/init.d/
+          install -m 0755 ${WORKDIR}/rc.pandora-lcd-state ${D}${sysconfdir}/init.d/pandora-lcd-state
+         install -d ${D}${sysconfdir}/pandora/conf/
+          install -m 0644 ${WORKDIR}/gamma.state ${D}${sysconfdir}/pandora/conf/gamma.state
+          install -m 0644 ${WORKDIR}/brightness.state ${D}${sysconfdir}/pandora/conf/brightness.state
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES_${PN} += "${prefix} ${datadir}"
diff --git a/recipes/pandora-system/pandora-lcd-state/brightness.state b/recipes/pandora-system/pandora-lcd-state/brightness.state
new file mode 100644 (file)
index 0000000..597975b
--- /dev/null
@@ -0,0 +1 @@
+35
\ No newline at end of file
diff --git a/recipes/pandora-system/pandora-lcd-state/gamma.state b/recipes/pandora-system/pandora-lcd-state/gamma.state
new file mode 100644 (file)
index 0000000..e5edf04
--- /dev/null
@@ -0,0 +1 @@
+105 315 381 431 490 537 579 686 780 837 880 1023
diff --git a/recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state b/recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state
new file mode 100644 (file)
index 0000000..a11d656
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          pandora-lcd-state
+# Required-Start:    #adjust
+# Required-Stop:     #adjust
+# Default-Start:     S
+# Default-Stop:      0 1 6
+### END INIT INFO
+DESC="OpenPandora Save and Restore LCD Settings"
+NAME="pandora-lcd-state"
+
+d_stop() {
+       echo "Saving LCD-Settings"
+       cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /etc/pandora/conf/brightness.state
+       cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /etc/pandora/conf/gamma.state
+}
+
+d_start() {
+       echo "Restoring LCD-Settings"
+       cat /etc/pandora/conf/brightness.state > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness 
+       cat /etc/pandora/conf/gamma.state > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+}
+
+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_start
+       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
index 5809944..c0f5def 100644 (file)
@@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 DEPENDS = "zenity dbus"
 RDEPENDS = "zenity dbus"
 
-PR = "r10"
+PR = "r12"
 
 SRC_URI = " \
           file://op_bright.sh \
@@ -27,6 +27,8 @@ SRC_URI = " \
           file://op_calibrate.desktop \
           file://op_datetime.sh \
           file://op_datetime.desktop \
+         file://op_usermanager.sh \
+          file://op_usermanager.desktop \
           file://gui.conf \
 "
 
@@ -40,6 +42,7 @@ do_install() {
           install -m 0755 ${WORKDIR}/op_switchgui.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_calibrate.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_datetime.sh ${D}${prefix}/pandora/scripts/
+         install -m 0755 ${WORKDIR}/op_usermanager.sh ${D}${prefix}/pandora/scripts/
           
           install -d ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_cpuspeed.desktop ${D}${datadir}/applications/
@@ -49,6 +52,7 @@ do_install() {
           install -m 0644 ${WORKDIR}/op_switchgui.desktop ${D}${datadir}/applications/          
           install -m 0644 ${WORKDIR}/op_calibrate.desktop ${D}${datadir}/applications/
           install -m 0644 ${WORKDIR}/op_datetime.desktop ${D}${datadir}/applications/
+         install -m 0644 ${WORKDIR}/op_usermanager.desktop ${D}${datadir}/applications/
           
           install -d ${D}${sysconfdir}/xdg/autostart/
           install -m 0644 ${WORKDIR}/op_bluetooth-check.desktop ${D}${sysconfdir}/xdg/autostart/op_bluetooth-check.desktop
index 99fe690..dd5445e 100644 (file)
@@ -3,7 +3,7 @@ Name=Set Backlight Brightness
 Comment=Set the brightness of the backlight.
 StartupNotify=false
 Exec=sudo /usr/pandora/scripts/op_bright.sh
-Icon=Terminal
+Icon=dialog-information
 Terminal=false
 Type=Application
 Categories=System;
index aa5432c..bcf74eb 100644 (file)
@@ -3,7 +3,7 @@ Name=Calibrate Touchscreen
 Comment=Calibrates the touchscreen. Restart afterwards
 StartupNotify=false
 Exec=/usr/pandora/scripts/op_calibrate.sh
-Icon=Terminal
+Icon=input-tablet
 Terminal=false
 Type=Application
 Categories=System;
index 5232834..96bbfff 100644 (file)
@@ -3,7 +3,7 @@ Name=Set CPU speed
 Comment=Under or overclock your OpenPandora CPU.
 StartupNotify=false
 Exec=sudo /usr/pandora/scripts/op_cpuspeed.sh
-Icon=Terminal
+Icon=xfce4-mixer
 Terminal=false
 Type=Application
 Categories=System;
index 94cb6cd..69910ae 100644 (file)
@@ -3,7 +3,7 @@ Name=Set Date and Time
 Comment=You can also select the timezone.
 StartupNotify=false
 Exec=sudo /usr/pandora/scripts/op_datetime.sh
-Icon=Terminal
+Icon=document-open-recent
 Terminal=false
 Type=Application
-Categories=System;
+Categories=Settings;
index 249bbf2..f6d8a6b 100644 (file)
@@ -3,7 +3,7 @@ Name=Select the default GUI
 Comment=Change the default OpenPandora GUI.
 StartupNotify=false
 Exec=/usr/pandora/scripts/op_defaultgui.sh
-Icon=Terminal
+Icon=krfb
 Terminal=false
 Type=Application
-Categories=System;
+Categories=Settings;
index 3eaa905..31029cd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change he Default GUI" --list --multiple --column "Name" --column "Description" --text "Please select the GUI you want to run as default startup" )
+selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change he Default GUI" --list --column "Name" --column "Description" --text "Please select the GUI you want to run as default startup" )
 echo $selection
 
 gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
index 263ecb1..839667e 100644 (file)
@@ -3,7 +3,7 @@ Name=Switch GUI
 Comment=Switch to a different GUI.
 StartupNotify=false
 Exec=/usr/pandora/scripts/op_switchgui.sh
-Icon=Terminal
+Icon=krfb
 Terminal=false
 Type=Application
 Categories=System;
index 043e0e5..d401cd4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Switch to a different GUI" --list --multiple --column "name" --column "description" --text "Select a GUI you want to switch to" )
+selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Switch to a different GUI" --list --column "name" --column "description" --text "Select a GUI you want to switch to" )
 echo $selection
 
 gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}')
diff --git a/recipes/pandora-system/pandora-scripts/op_usermanager.desktop b/recipes/pandora-system/pandora-scripts/op_usermanager.desktop
new file mode 100644 (file)
index 0000000..a8cc0d0
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Usermanager
+Comment=A very simple usermanager
+StartupNotify=false
+Exec=gksudo /usr/pandora/scripts/op_usermanager.sh
+Icon=system-users
+Terminal=false
+Type=Application
+Categories=System;
diff --git a/recipes/pandora-system/pandora-scripts/op_usermanager.sh b/recipes/pandora-system/pandora-scripts/op_usermanager.sh
new file mode 100755 (executable)
index 0000000..9743a34
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+if zenity --question --title="Usermanager" --text="Do you wish to add or remove a user?" --ok-label="Add user" --cancel-label="Remove User"; then              
+
+       echo "Add user"
+       while ! name=$(zenity --title="Enter full name" --entry --text "Please enter a full name for the new user.") || [ "x$name" = "x" ] ; do
+           zenity --title="Error" --error --text="Please try again." --timeout 6
+       done
+
+       username_guess=$(echo "$name" | cut -d" " -f1 | tr A-Z a-z)
+
+       while ! username=$(zenity --title="Enter the new username" --entry --text "Please choose a short username.\n\nIt 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." --timeout 6
+       done
+
+       while ! useradd -c "$name,,," -G adm,audio,video,wheel,netdev,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
+
+       password=""
+       while [ x$password = x ] ; do
+         password1=$(zenity --title=Password --entry --text="Please 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="The passwords do not match.\n\nPlease try again." --timeout 6
+         else 
+               if [ x$password1 = x ] ; then
+                       zenity --title="Error" --error --text="Password cannot be blank!\n\nPlease try again." --timeout 6
+               else
+                       password=$password1
+               fi
+         fi
+       done
+
+       passwd "$username" <<EOF
+       $password
+       $password
+EOF
+       if zenity --question --title="User created" --text="The user $username has been successfully created.\n\nDo you want to set this user as default user for the login?" --ok-label="Yes, please!" --cancel-label="No, keep the old user as default"; then
+           sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf
+       fi
+       zenity --info --title="User created" --text "Thanks. The new user can now be used." --timeout 6
+else
+        xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
+        echo "Remove User"
+       amount=$(cat /etc/passwd | grep /home/ | grep -v root | awk -F\: '{print $1 }' | wc -l)
+       if [ ${amount} = "1" ]; then
+             zenity --title="Error" --error --text="Sorry! You can't remove the last normal user!" --timeout 6
+       else
+             selection=$(cat /etc/passwd | grep /home/ | grep -v root | grep -v $xfceuser | awk -F\: '{print $1 }' | zenity --width=100 --height=200 --title="Select the user to delete" --list  --column "Username"  --text "Select the user to delete\n\nPlease note: You can't remove the user that is currently logged in.")
+             if zenity --question --title="Confirm User Removal" --text="Are you REALLY sure you want to remove the user $selection?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove user!" --cancel-label="Don't remove the user"; then
+                 echo "Really remove $selection"
+                 userdel -fr $selection
+                 sed -i "s/.*default_user $selection/default_user/g" /etc/slim.conf
+                 zenity --info --title="User removed" --text "The user $selection has been removed." --timeout 6
+             else
+                 echo "Don't remove $selection"
+                 zenity --info --title="User not removed" --text "Cancelled removal of user $selection at user's request." --timeout 6
+             fi
+       fi
+fi
+
+
+
index 995a358..4c06a81 100644 (file)
@@ -3,7 +3,7 @@ Name=Toggle WiFi
 Comment=Toggle the status of the WiFi chip.
 StartupNotify=false
 Exec=sudo /usr/pandora/scripts/op_wifi.sh
-Icon=Terminal
+Icon=network-wireless
 Terminal=false
 Type=Application
 Categories=System;
index b1c0d38..1fcd3d4 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 # /etc/skel is used by Shadow's useradd so you really have that installed for this to make sense ;)
 RDEPENDS = "shadow"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = " \
   file://.xinitrc \     
index 4c3bbb5..17b634a 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "sudo"
 
-PR = "r0"
+PR = "r1"
 
 SRC_URI = " \
           file://50_openpandora \
index e2e0f69..ac10305 100755 (executable)
@@ -104,6 +104,7 @@ LAUNCHERS = " \
 PANDORA = " \
   pandora-first-run-wizard hsetroot \
   pandora-scripts \
+  pandora-lcd-state \
   pandora-wallpaper-official pandora-wallpaper-community \
   pandora-xfce-defaults \
   pandora-xmms-defaults xmms \