pandora-scripts: username handling fixes from russ
authorGrazvydas Ignotas <notasas@gmail.com>
Sat, 22 Mar 2014 16:57:02 +0000 (18:57 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 22 Mar 2014 16:57:02 +0000 (18:57 +0200)
russ said:
"finding the user's home directory" really ought to be factored out to
somewhere generic (/usr/pandora/scripts/op_paths.sh perhaps, assuming
there's some reason this all doesn't just use $HOME), but if this OS
release series is moribund I'll just fix what's broken rather than
cleaning up the ugliness

recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_lidsettings.sh
recipes/pandora-system/pandora-scripts/op_power.sh

index e0cc35f..f36fce7 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "bash sed gawk grep zenity"
 
-PR = "r156"
+PR = "r157"
 
 SRC_URI = " \
           file://op_paths.sh \
index aa0cc01..995d4ec 100644 (file)
@@ -1,6 +1,6 @@
 #!/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
+case "$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig)" in
        "lowpower")
                current="the Pandora goes into low power mode"
        ;;
@@ -14,4 +14,4 @@ esac
 
 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" > $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig
index 461ecb3..bba0f51 100644 (file)
@@ -12,9 +12,9 @@ debug(){
        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
+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)
+#powerbuttonconfig=$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.powerbuttonconfig)
 
 if [ -e /tmp/powerstate ]; then 
        powerstate="$(cat /tmp/powerstate)"