RDEPENDS = "bash sed gawk grep zenity"
-PR = "r157"
+PR = "r158"
SRC_URI = " \
- file://op_paths.sh \
file://op_bright.sh \
+ file://op_common.sh \
file://op_cpuspeed.sh \
file://op_cpuspeed.pnd \
file://op_dspspeed.sh \
do_install() {
install -d ${D}${prefix}/pandora/scripts/
- install -m 0755 ${WORKDIR}/op_paths.sh ${D}${prefix}/pandora/scripts/
+ install -m 0755 ${WORKDIR}/op_common.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_getpndmg.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_osupgrade.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/
#!/bin/bash
-#usage op_shutdown.sh time in seconds
-xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
+# usage: op_shutdown.sh time in seconds
+
+. /usr/pandora/scripts/op_common.sh
+xfceuser=$(get_user)
+
time=$1
if [ x$time = "x" ]; then
time=30
#!/bin/bash
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
# get value range
minbright=3
#!/bin/sh
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
cur=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
if [ "$cur" -gt "40" ]; then
#!/bin/sh
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
cur=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
max=$(cat $SYSFS_BACKLIGHT/max_brightness)
--- /dev/null
+
+# files changing between kernel versions
+
+if [ -e /sys/class/backlight/pandora-backlight ]; then
+ SYSFS_BACKLIGHT=/sys/class/backlight/pandora-backlight
+elif [ -e /sys/class/backlight/twl4030-pwm0-bl ]; then
+ SYSFS_BACKLIGHT=/sys/class/backlight/twl4030-pwm0-bl
+else
+ echo "ERROR: backlight control not found" >&2
+ SYSFS_BACKLIGHT=/dev/null
+fi
+SYSFS_BACKLIGHT_BRIGHTNESS=${SYSFS_BACKLIGHT}/brightness
+
+if [ -e /sys/devices/omapdss/display0/gamma ]; then
+ SYSFS_GAMMA=/sys/devices/omapdss/display0/gamma
+elif [ -e /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma ]; then
+ SYSFS_GAMMA=/sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+else
+ echo "ERROR: gamma control not found" >&2
+ SYSFS_GAMMA=/dev/null
+fi
+
+SYSFS_DSS_GAMMA=/sys/devices/platform/omapdss/display0/dss_gamma
+
+# scripts run as root, but often need currently logged-in user
+get_user()
+{
+ # this file is created by .xinitrc
+ test -f /tmp/currentuser && _gu_user=$(cat /tmp/currentuser)
+ if [ -z "$_gu_user" ]; then
+ # try xfce4-session. ps can output names but only upto 19 chars, so resolve manually..
+ _gu_user_id=$(ps --no-headers -o ruid -C xfce4-session | tail -n1 | awk '{print $1}')
+ _gu_user=$(grep ":x:$_gu_user_id:" /etc/passwd | awk -F: '{print $1}')
+ fi
+ if [ -z "$_gu_user" ]; then
+ echo "ERROR: can't determine currently logged-in user" >&2
+ exit 1
+ fi
+ echo $_gu_user
+}
+
+get_user_home()
+{
+ _gu_user=$(get_user)
+ _gu_user_home=$(grep "^$_gu_user:" /etc/passwd | awk -F: '{print $6}')
+ if [ -z "$_gu_user_home" ]; then
+ echo "ERROR: can't determine currently logged-in user's home" >&2
+ exit 1
+ fi
+ echo $_gu_user_home
+}
+
#!/bin/bash
+
+. /usr/pandora/scripts/op_common.sh
+user=$(get_user)
+
if selection=$(grep "/dev/mmcblk" /proc/mounts | cut -f 2 -d " " | sed 's/\\040/ /g' | zenity --title="Create Pandora SD Card" --width="380" --height="250" --list --text="This utility creates the needed Pandora directories on your SD Card.\nYou can also use it to format your SD Card.\n\nPlease select the SD Card to be used (no data will be changed yet):" --column="Select card"); then
selection2=$(echo "$selection" | sed 's/ /\\\\040/g')
device=$(grep "${selection2}" /proc/mounts | awk '{print $1}')
sync
gksudo mkdir /tmp/mnt
if gksudo mount $device /tmp/mnt; then
- user=$(cat /tmp/currentuser)
gksudo mkdir /tmp/mnt/pandora
gksudo mkdir /tmp/mnt/pandora/menu
gksudo mkdir /tmp/mnt/pandora/apps
#!/bin/sh
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
if [ ! -e "$SYSFS_DSS_GAMMA" ]; then
echo "Control file is missing, might be incompatible kernel"
# Video-Settings, v1.2, written by Michael Mrozek aka EvilDragon 2010. Brightness-Settings-Part written by vimacs.
# This scripts allows you to create, load and save Gamma-Settings and to change the LCD Brightness.
- . /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
+user=$(get_user)
+user_home=$(get_user_home)
while mainsel=$(zenity --title="Video Settings" --width="300" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the Video Settings-Dialogue.\n\nWhat do you want to do?\n" "bright" "Change LCD Brightness" "gammasimple" "Manage Gamma (simple)" "gamma" "Manage Gamma (Advanced)" "filter" "Select current video filter" "filterdef" "Select default video filter" "sblank" "Enable/disable screen blanking" "rightclickmode" "Select Right-Click-Mode for touchscreen" "tvout" "Enable/disable TV Out on Startup" --ok-label="Change Setting" --cancel-label="Exit"); do
fi;;
"sblank")
- user=$(cat /tmp/currentuser)
if zenity --question --title="Screen blanking" --text="Do you want to enable or disable the automatic screen blanking?" --ok-label="Enable it" --cancel-label="Disable it"; then
- sed -i "s/.*xset.*/# DISPLAY=:0 xset s off/g" /home/${user}/.xinitrc
+ sed -i "s/.*xset.*/# DISPLAY=:0 xset s off/g" $user_home/.xinitrc
zenity --info --title="Screen blanking" --text "The automatic screen blanking has been enabled." --timeout 6
DISPLAY=:0 xset s on
else
- sed -i "s/.*xset.*/DISPLAY=:0 xset s off/g" /home/${user}/.xinitrc
+ sed -i "s/.*xset.*/DISPLAY=:0 xset s off/g" $user_home/.xinitrc
zenity --info --title="Screen blanking" --text "The automatic screen blanking has been disabled." --timeout 6
DISPLAY=:0 xset s off
fi;;
done;;
"rightclickmode")
- user=$(cat /tmp/currentuser)
if zenity --question --title="Right-Click Mode" --text="Choose how you would like to do a right-click with the touchscreen: You can either use the click-and-hold-method to right click or to use ALT as modifier key." --ok-label="ALT as modifier" --cancel-label="Click-and-Hold"; then
- echo 'mode = 1' > /home/$user/Applications/Settings/libgtkstylus.conf
+ echo 'mode = 1' > $user_home/Applications/Settings/libgtkstylus.conf
zenity --info --title="Right-Click" --text "To do a right-click with the stylus, press and hold the ALT button while clicking.\n\nYou need to restart X to enable this." --timeout 6
else
- echo 'mode = 0' > /home/$user/Applications/Settings/libgtkstylus.conf
+ echo 'mode = 0' > $user_home/Applications/Settings/libgtkstylus.conf
zenity --info --title="Right-Click" --text "To do a right-click with the stylus, press and hold the stylus on the screen.\n\nYou need to restart X to enable this." --timeout 6
fi;;
# Released under the GPL
# LED-Settings, v1.0, written by Michael Mrozek aka EvilDragon 2013.
- . /usr/pandora/scripts/op_paths.sh
+ . /usr/pandora/scripts/op_common.sh
while mainsel=$(zenity --title="LED-Settings" --width="400" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the LED-Settings-Dialogue.\n\nWhat do you want to do?\n" "normal" "Set Power LED Brightness (normal mode)" "power" "Set Power LED Brightness (powersave)" "sd1" "Enable / Disable SD1 LED" "sd2" "Enable / Disable SD2 LED" "wifi" "Enable / Disable WiFi LED" "bt" "Enable / Disable Bluetooth LED" --ok-label="Change Setting" --cancel-label="Exit"); do
#!/bin/bash
# change what to do when the lid is closed/opened
-case "$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig)" in
+
+. /usr/pandora/scripts/op_common.sh
+user_home=$(get_user_home)
+
+case "$(cat $user_home/.lidconfig)" in
"lowpower")
current="the Pandora goes into low power mode"
;;
sel=$(zenity --title="Lid settings" --height=250 --list --column "id" --column "Please select" --hide-column=1 --text="What should happen when you close the Pandora's lid?\n(the opposite of the selected action is performed when opening the lid again)\nAt the moment $current when you close the lid." "brightness" "Turn off the screen." "lowpower" "Go into low power mode (same as when pressing the
power button for less than 3 seconds)" "shutdown" "Shut the pandora down.") || exit
-echo "$sel" > $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig
+echo "$sel" > $user_home/.lidconfig
#!/bin/bash
-#actions done when the menu button is pressed
-#only argument is the time the button was pressed in seconds
+# actions done when the menu button is pressed
+# only argument is the time the button was pressed in seconds
if [ -x /usr/pandora/scripts/op_menu_custom.sh ]; then
exec /usr/pandora/scripts/op_menu_custom.sh "$@"
fi
+. /usr/pandora/scripts/op_common.sh
+xfceuser=$(get_user)
+
do_kill()
{
for PID in "$@"; do
xpid=$(pidof xfce4-session)
if [ $xpid ]; then
echo "xfce4 is running"
- # note: max username length ps can output is 19, otherwise it prints uid
- xfceuser=$(ps -o user:20= -C xfce4-session | tail -n1 | awk '{print $1}')
if [ $killist ]; then
echo "displaying kill list"
pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*-\(.*\)(\([0-9]\+\))/\2\n \1/p' | su -c 'DISPLAY=:0.0 zenity --list --multiple --column "pid" --column "name" --title "kill" --text "which apps should be killed"' - $xfceuser | sed 's/|/\n/')
+++ /dev/null
-
-# files changing between kernel versions
-
-if [ -e /sys/class/backlight/pandora-backlight ]; then
- SYSFS_BACKLIGHT=/sys/class/backlight/pandora-backlight
-elif [ -e /sys/class/backlight/twl4030-pwm0-bl ]; then
- SYSFS_BACKLIGHT=/sys/class/backlight/twl4030-pwm0-bl
-else
- echo "ERROR: backlight control not found" >&2
- SYSFS_BACKLIGHT=/dev/null
-fi
-SYSFS_BACKLIGHT_BRIGHTNESS=${SYSFS_BACKLIGHT}/brightness
-
-if [ -e /sys/devices/omapdss/display0/gamma ]; then
- SYSFS_GAMMA=/sys/devices/omapdss/display0/gamma
-elif [ -e /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma ]; then
- SYSFS_GAMMA=/sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
-else
- echo "ERROR: gamma control not found" >&2
- SYSFS_GAMMA=/dev/null
-fi
-
-SYSFS_DSS_GAMMA=/sys/devices/platform/omapdss/display0/dss_gamma
#!/bin/bash
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
+xfceuser=$(get_user)
+xfceuser_home=$(get_user_home)
# XXX: better use lockfile (or something), but it's not in current firmware
test -e /tmp/op_power.lock && exit 2
return 1 # 0 when debugging, 1 when not
}
-test -e $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig && lidconfig=$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig) # read lid conf. file if it exists
-
-#powerbuttonconfig=$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.powerbuttonconfig)
+test -e $xfceuser_home/.lidconfig && lidconfig=$(cat $xfceuser_home/.lidconfig) # read lid conf. file if it exists
if [ -e /tmp/powerstate ]; then
powerstate="$(cat /tmp/powerstate)"
show_message() {
# TODO: check if desktop is visible; maybe use layer3?
- xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
cmd="DISPLAY=:0.0 zenity --info --text \"$1\" --timeout 10"
su -c "$cmd" $xfceuser
}
}
shutdown(){ # warns the user and shuts the pandora down
- xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
time=5
countdown () {
for i in $(seq $time); do
# Startup-Manager, v1.1, written by Michael Mrozek aka EvilDragon 2010 with some help by vimacs.
# This scripts allows you to change various settings of the Pandora startup process.
+. /usr/pandora/scripts/op_common.sh
+user2=$(get_user)
+user2_home=$(get_user_home)
+
while mainsel=$(zenity --title="Startup manager" --width="400" --height="310" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the Startup Settings\n\nHere you can change the default boot-up behaviour of your Pandora.\n\nWhat do you want to do?\n" "gui" "Change Default GUI for current user" "login" "Enable/Disable auto login" "user" "Select default user" "service" "Enable/Disable services on boot" --ok-label="Change Setting" --cancel-label="Exit"); do
# Change default GUI
"gui")
- user2=$(cat /tmp/currentuser)
selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change the 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}')
if [ $gui ]; then
- sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" /home/$user2/.xinitrc
+ sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" $user2_home/.xinitrc
zenity --info --title="Changed session" --text "The default session has been changed to $selection." --timeout 6
fi;;
done
;;
esac
-done
\ No newline at end of file
+done
# Reworked for the OpenPandora - John Willis/Michael Mrozek
# This scripts allows you to create and remove users from the Pandora system.
+. /usr/pandora/scripts/op_common.sh
+user2=$(get_user)
+
while selection=$(zenity --title="Usermanager" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "add" "Add a user" "remove" "Remove a user" ); do
if [ ${selection} = "add" ]; then
echo "Add user"
fi
fi
elif [ ${selection} = "remove" ]; then
- user2=$(cat /tmp/currentuser)
echo "Remove User"
amount=$(cat /etc/passwd | grep /home/ | grep -v root | awk -F\: '{print $1 }' | wc -l)
if [ ${amount} = "1" ]; then
RDEPENDS = "pandora-scripts"
-PR = "r22"
+PR = "r23"
inherit update-rc.d
INITSCRIPT_NAME = "pandora-state"
DESC="OpenPandora Save and Restore various settings"
NAME="pandora-state"
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
d_stop() {
echo "Saving Pandora specific settings"