To easily get access to my external Files, Scripts, RoxApps, RunScripts, Linux & Wine Portables etc.pp. from within a bash script I used to use a simple code section in almost all of my scripts - therefor I hold multiple templates in /root/Choices/Templates like this one (marked up code is the mean part).
I'm using this to e.g. send .cpt files directly from a JWM Menu Pipe to the Corel Photopaint Application installed into a Wine SFS which loads automatically then.#!/bin/bash -a
#------------------------------------------------------------------------------
# Empty Script for LazY Puppy
# 2012-12-28 RSH for LazY Puppy
#------------------------------------------------------------------------------
# Get Application Directory
#--------------------------
APPDIR="`dirname "$0"`" # Application Directory
APPDIRAPP="`basename "$0"`" # Application Name
APPDIRDIR="`dirname "$APPDIR"`" # Directory of Application Directory
[ "$APPDIR" = "." ] && APPDIR="`pwd`"
export APPDIR="$APPDIR"
export APPDIR=`dirname "$0"`
[ "$APPDIR" = '.' ] && export APPDIR=`pwd`
# Get Boot Directory and $LPED definition File (LazY Puppy, L.A.S.S.I.E.)
if [ -f /usr/sbin/ceelab/tools/get_lped ]; then
[ ! -f /tmp/my_lped ] && /usr/sbin/ceelab/tools/get_lped
read LPED < /tmp/my_lped
[ ! -f "$LPED" ] && /usr/sbin/ceelab/tools/get_lped
. /usr/sbin/ceelab/lp2_sys_data/LP2_BootDir
[ -f "$LPED" ] && . "$LPED"
[ -f "$LPED" ] && LPEDFOUND="true" || LPEDFOUND="false"
else
LPEDFOUND="false"
echo "Note: File '/usr/sbin/ceelab/tools/get_lped' not found"
echo "Could not examine System Boot Directory"
echo "Also could not examine external Configurations File (e.g.: lped.cfg)."
echo "Hopefully, it's not needed for this OS/Script/Application..."
NOLPEDMSG="\n Note: File '/usr/sbin/ceelab/tools/get_lped' not found \n
Could not examine System Boot Directory \n
Also could not examine external Configurations File (e.g.: lped.cfg). \n
Hopefully, it's not needed for this OS/Script/Application... \n"
Xdialog --title "$AppTitle $AppVersion" --timeout 10 --icon "/usr/share/pixmaps/pads.png" --no-buttons --no-ok-label --no-cancel-label --msgbox "$NOLPEDMSG" 0 0 0 &
fi
# Now ready to use all external Scripts, RoxApps, Directories and Files
exit 0
#------------------------------------------------------------------------------
# End
#------------------------------------------------------------------------------
While developing my T.O.P.L.E.S.S. I felt in Love with some Idea and then I've successfully tried to get the results of these special scripts (called in code above) into some global Environment Variables.
Instead of using above marked code I can use now a global Environment Variable to get access to Files, Programs and Directories.
List of my new Global Environment Variables:
Code: Select all
$MYBOOTDIR $MYPAR2PRT
$MYBOOTPRT $MYPIKONAPRG
$MYEXTERNALRUNSCRIPTS $MYROXAPPS
$MYEXTERNALSFSPLUSSCRIPTS $MYRSHROXAPPS
$MYFILES $MYRSHSCRIPTBOX
$MYIMAGEMAGICKSFS $MYSARARSD
$MYIMAGICKSFS $MYSARASCRIPTBOX
$MYJDKSFS $MYSCRIPTS
$MYJRESFS $MYSYMLINKSTARGET
$MYLINUXAPPS $MYWINEAPPS
$MYLPED $MYWINEAPPSSTARTER
$MYMODULES $MYWINEINSTALLS
$MYPAR1PRT $MYWINESFS
$MYBOOTDIR will return /mnt/sde1/Tahr602CE if boot drive is sde1
$MYMODULES will return /mnt/sde1/Module (depends on what directory is declared in the $LPED file in code above)
$MYWINESFS will return LP2_WineCorelSuite.sfs (depends on what SFS is declared in the $LPED file in code above)
So I'm loading the Wine SFS just by executing:
Code: Select all
lazy_sfs_load --cli --skip-fixmenus --quiet $MYMODULES/$MYWINESFS
To start Corel Photopaint 8 and to send the .cpt file to it I'm just using a second line in the script.
Code: Select all
exec wine start /Unix "/root/.wine/drive_c/Corel/Graphics8/Programs/photopnt.exe $@"
And, whooossshhhh...
...it worked out of the box!
Since I'm able here to let a pupmode=5 Puppy execute content of an external Script from a sub-directory of boot directory to be executed then in /etc/profile.local I just added a function to the external Script file. Just letting it play the 2barks.wav file in /usr/share/audio.
Code: Select all
function playme(){
aplay "/usr/share/audio/2barks.wav"
} # playme
export -f playme
Hit enter and file /usr/share/audio/2barks.wav was immediately played by aplay!
So as you might already assume by the above function: the "secret" is to export anything at boot up that you want to get for a GLOBAL and EASY use.
I'm doing this in /etc/profile.local as $PATH is made global in /etc/profile and /etc/profile.local is next step after /etc/profile. I'm not sure about it, but some of this probably could be made also in /etc/rc.d/rc.local.