From: Grazvydas Ignotas Date: Sun, 19 Oct 2014 23:19:03 +0000 (+0300) Subject: pnd_run.sh: restore nub settings on last pnd exit X-Git-Tag: sz_173~10 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=commitdiff_plain;h=a2006173780c382153fd079fcc7ac353226ea1f6 pnd_run.sh: restore nub settings on last pnd exit For misbehaving PNDs. Idea by LinuxSwat. --- diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index ab02b26..c6cdc9b 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -626,6 +626,17 @@ main() { ofbset -fb /dev/fb1 -mem 0 -size 0 0 -en 0 fi PND_EndTask + + running_pnd_count=$(ps ax | grep "pnd_run.s[h]" | wc -l) + # restore settings if we are the last exiting pnd + # compare with 2 because one is used by subshell where "ps ax | ..." runs + if [ "$running_pnd_count" -eq "2" ]; then + PND_BeginTask "Restoring nub mode" + sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode + sed -n '7p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mode + PND_EndTask + fi + PND_BeginTask "uMount the PND" umountUnion PND_EndTask