Pnd run.sh

From Pandora Wiki
Jump to: navigation, search

Advanced launching of PND. It would be good to have basic shell scripting knowledge before proceeding with this article.

Contents

Usage

Usage:

 pnd_run.sh -p file.pnd -e cmd [-a args] [-b pndid] [-s path] [-c speed] [-d [path]] [-x] [-m] [-u]
   -p file.pnd	: Specify the pnd file to execute
   -e cmd	: Command to run
   -a args	: Arguments to the command
   -b pndid	: name of the directory mount-point (/mnt/utmp/pndid) (Default: name of the pnd file)
   -s path	: Directory in the union to start the command from
   -o speed	: Set the CPU speed
   -d [path]	: Use path as source of the overlay. (Default: pandora/appdata/pndid)
   -x		: Stop X before starting the apps
   -m		: Only mount the pnd, dont run it (-e become optional)
   -u		: Only umount the pnd, dont run it (-e become optional)

Arguments

It is possible to execute the content of your pnd using arguments. This can be done by passing -a to pnd_run.sh with arguments quoted

-a "--arg 1"

Creating a launch script for PND

For PND to function normally, you usually need to pass the PND ID and correct executable to pnd_run.sh script. These can be found by examining PXML data that is appended in PNDs, or alternatively you can find IDs by using various package managers and executable paths by checking the .desktop files generated by PND system.

pnd_run.sh -p /media/SD1/pandora/menu/Chromium.pnd -e "chrome.sh" -b "chromium" -a "$*"

Where chromium is the PND's ID found from PXML, and chrome.sh is the application found from .desktop file.

Modifying PNDs launch script(s) to accept arguments

With the Chromium.pnd it's not possible to use any additional arguments for the browser by default. This is because the launch script it uses does not expect arguments to be passed to it, and therefore does not pass them to chrome binary.

For example, the original chrome.sh from Chromium.pnd (as time of writing), looks like this:

#!/bin/sh
# /mnt/utmp/chromium/chrome.sh
HOME="/tmp"
mkdir ./Default
mkdir /tmp/chromium
cp "First Run" /tmp/chromium/
ln -s /mnt/utmp/chromium/Default /tmp/chromium/Default
export HOME
export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
export XDG_CONFIG_HOME=$HOME
./chrome
rm -r /tmp/chromium

Notice that it launches ./chrome and does not give any arguments for it.

As the original launch script resides in PND that is read-only file system, you can't modify it directly. However you can copy the script to that PND's appdata directory, which overrides the files of PND when mounted.

So copy it and modify this part:

./chrome $@

So it should look like this in the end:

#!/bin/sh
# /media/SD1/pandora/appdata/chromium/chrome.sh 
HOME="/tmp"
mkdir ./Default
mkdir /tmp/chromium
cp "First Run" /tmp/chromium/
ln -s /mnt/utmp/chromium/Default /tmp/chromium/Default
export HOME
export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
export XDG_CONFIG_HOME=$HOME
./chrome $@
rm -r /tmp/chromium

There probably exists many more PNDs that don't expect arguments, and it's problematic when you actually need to pass them arguments, or make them as launchers for some file types. So you need to learn how to modify them.

Making Chromium the default browser of XFCE using the PND

Create launch script such as:

#!/bin/sh
# /media/SD1/launchers/chromium.sh
/usr/pandora/scripts/pnd_run.sh -p /media/SD1/pandora/menu/Chromium.pnd -e "chrome.sh" -b "chromium" -a "$*"

Save the script somewhere and make it as executable:

chmod +x /media/SD1/launchers/chromium.sh

Then go to Settings > Desktop > Preferred Applications, and point the Web Browser to your script. When opening URLs in XFCE environment, they should open in Chromium now.

Personal tools
community