How To Make A Lazy Puppy Style Menu?

Using applications, configuring, problems
Post Reply
Message
Author
FUD
Posts: 10
Joined: Sat 01 Jul 2017, 14:48

How To Make A Lazy Puppy Style Menu?

#1 Post by FUD »

Hi,

I'm trying to add the finishing touches to my puppy by setting up a 'Lazy Puppy' style menu to access SFS files from the DVD. (32 bit tahrpup-6.0.5-PAE on a 32 bit Dell)

Now that my all my SFS's are done and I'm putting all the pieces back together on the DVD and I'm unable to get the menu/script to work properly.

Thought I already had this issue resolved previously on a different puppy. Not so, my (human) memory isn't what it used to be I guess.

This involves using 'simple-run-script-d.sh' to set up a Lazy Puppy style menu that does it all: when menu item is clicked it mounts the DVD, loads the program, and unloads when closed.

One program loads fine, the other doesn't. Below is a video that shows the problem better than I could explain it.

https://www.screencast.com/t/qCZMTgQPFH

Not sure what I'm missing? Something not in *.menu? Name changes done on the script? Or needs a script mod?

* All SFS programs now reside on the DVD in a folder in this format:
* /mnt/sr0/SFS/name_of_program.sfs
* Scripts are in /usr/local/bin/
* Fixmenus works properly.

If it's a relatively easy fix I would go ahead and finish it up. If not I wouldn't bother with it and will just access the programs manually from the DVD.

It wouldn't have the Lazy flair to it but it'll do.

Any suggestion I could try? Thanks.

If not then I'll finish this puppy up by using everyone's tips and sit back in my rocking chair and play with my puppy. It's that time. :D
Last edited by FUD on Sun 07 Jan 2018, 01:11, edited 1 time in total.

Sailor Enceladus
Posts: 1543
Joined: Mon 22 Feb 2016, 19:43

#2 Post by Sailor Enceladus »

So simple screen option works but Filezilla doesn't? Hard to know the problem without being able to see what Filezilla entry in /usr/share/applications opens and what is happening inside the script in it's Exec= line (if it's a script like simple-run-script-d.sh).

FUD
Posts: 10
Joined: Sat 01 Jul 2017, 14:48

#3 Post by FUD »

Hi Sailor, thanks for your response.

Contents of /usr/share/applications/FileZilla.desktop

[Desktop Entry]
Encoding=UTF-8
Name=FileZilla
Icon=/usr/share/pixmaps/frisbee.png
Comment=FileZilla
Exec=/usr/local/bin/simple-run-script-f.sh
Terminal=false
Type=Application
Categories=Onthefly
GenericName=FileZilla

............

Contents of simple-run-script-f.sh (this is a simple-run-script-d.sh renamed because I couldn't add both to /usr/local/bin)

# Define Names of SFS File and Program to load and to run
NameOfProg="FileZilla"
NameOfSFS="/mnt/sr0/SFS/FileZilla_3906_6.0.5.sfs"
#NameOfSFS="FileZilla_3906_6.0.5.sfs"

# Not here ! ! !
BNameOfSFS="`basename $NameOfSFS`"

.............

* Click SFS file on sr0 works
* Click on filezilla.desktop and it mounts sr0 but program does not load.
* Click on script in /usr/local/bin/ mounts sr0 but does not load.

Thanks for your help.

FUD
Posts: 10
Joined: Sat 01 Jul 2017, 14:48

#4 Post by FUD »

Full code:

#!/bin/bash -a
#------------------------------------------------------------------------------
# Basic RunScript, first step of the LazY Puppy SFS P.L.U.S. RunScripts
# Edition No. 4 for the murga forum users to use this on cd/dvd/hd/usb
# 2012-12-07 RSH for (LazY) Puppy Linux
#------------------------------------------------------------------------------
# Note: adding the path to the sfs name increases the speed of loading a sfs
#------------------------------------------------------------------------------

# Define Names of SFS File and Program to load and to run
NameOfProg="FileZilla"
NameOfSFS="/mnt/sr0/SFS/FileZilla_3906_6.0.5.sfs"
#NameOfSFS="FileZilla_3906_6.0.5.sfs"

# Not here ! ! !
BNameOfSFS="`basename $NameOfSFS`"

#------------------------------------------------------------------------------
# Create AutoUnload Script Function
# Do not change anything in this here section ! ! !
# But you can modify 'sleep 2' to what's your like
#------------------------------------------------------------------------------
# Create AutoUnload Script
function CreateAutoUnloadScript(){
# Check if Program runs
ProgRuns=echo $(`pidof "$NameOfProg"`)
if [ "$ProgRuns" != "" ]; then
echo '#!/bin/bash
AutoUnload="true"
#ProgRuns=echo $(`pidof "'$NameOfProg'"`)
while [ "$AutoUnload" = "true" ];
do
#ProgRuns=echo $(`pidof "'$NameOfProg'"`)
if [ "`pidof "'$NameOfProg'"`" != "" ]; then
echo "'$NameOfProg' is still running"
sleep 2
else
sfs_load --unload --cli --skip-fixmenus --quiet "'$NameOfSFS'"
AutoUnload="false"
fi
done
echo "SFS unloaded and AutoUnload exited"
exit 0'> /tmp/$BNameOfSFS.AutoUnload.sh
chmod 755 /tmp/$BNameOfSFS.AutoUnload.sh
fi # if [ "$ProgRuns" != "" ]; then
}
#------------------------------------------------------------------------------
# End of create AutoUnload Script Function
#------------------------------------------------------------------------------

# '$NameOfProg' might need the path if not in /usr/bin or /usr/sbin
# If Program exits then go
if [ "$(which $NameOfProg)" ]; then
# Execute Program
exec "$NameOfProg" &
else # Program doesn't exist ---> do load the SFS first
# Load the SFS
sfs_load --cli --skip-fixmenus --quiet "$NameOfSFS"
# Execute Program
exec "$NameOfProg" &
CreateAutoUnloadScript
# Execute AutoUnload Script ---> runs in background
/tmp/$BNameOfSFS.AutoUnload.sh
# Remove AutoUnload Script
rm /tmp/$BNameOfSFS.AutoUnload.sh
fi # if [ "$(which $NameOfProg)" ]; then

exit 0

#------------------------------------------------------------------------------
# End of simple-run-script-c ---> This is so cool, isn't it?
#------------------------------------------------------------------------------

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#5 Post by CatDude »

Hi

@ FUD

Try changing this:

Code: Select all

NameOfProg="FileZilla"
to this:

Code: Select all

NameOfProg="filezilla"
CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

FUD
Posts: 10
Joined: Sat 01 Jul 2017, 14:48

#6 Post by FUD »

CatDude,

Thanks for your eyes! Your suggestion did work and FileZilla now loads properly.

Just to clarify, should anyone need it, the thread title was meant to be a question not a statement. The missing ? was an oversight on my part and "all my SFS's" = the ones I needed from archive and the few that I made for myself.

Gotta start somewhere. If my experimenting, trial, and error causes me to murder some file names in the process I'll have to live with myself. If I wanted to see an original file name I would only need to look below at Simple Scan.

Thanks for everyones time on this, I appreciate it.

FUD
Posts: 10
Joined: Sat 01 Jul 2017, 14:48

#7 Post by FUD »

Here is a working example of this script.

https://www.screencast.com/t/GjmaAvmqYgT

Key Points
* From the SFS files on the archive, some work straight away others will/may not end up working.
* For your own files you will need the LP2_ prefix as part of your file name.
* It may be easier to take a .pet file and run it through 'pets2sfsgui'.
* Trimming off the excess from a file name sometimes helps.
* Example: LibreOffice-4.4.1_en-GB_xz.pet becomes LP2_LibreOffice-4.4.1_ (pets2sfsgui adds your version number here).sfs

Are there other/better ways to do it? There always are but this does all I need it to. It auto unloads the SFS about 99% of the time and works fine. But you can rest assured that at least one of the programs you use every day will be the one that decides not to auto-unload. :o

Post Reply