Mounting and Linking SFS files for use

Under development: PCMCIA, wireless, etc.
Message
Author
PupGeek
Posts: 353
Joined: Sun 06 Sep 2009, 11:30

#21 Post by PupGeek »

It will only copy files that actually have to be copied. For example, like that config file in gimp that needs to be copied to /etc. But it will simply mount and export PATH and LD_LIBRARY_PATH variables and such for files that do not need to be copied.

I include dependencies within the files to accomodate those without an internet connection at home (such as myself). That way the user can download the file from an online computer then copy it across to their offline machine. If you use a computer with no internet connection, dependency issues can really test your patience.... I am just thinking about others who have to deal with it is all.

Anyways, the overall concept is just like you mentioned but you are basically using a roxapp as a wrapper for the sfs file.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#22 Post by sunburnt »

No internet, how do you get the SFS in the first place? ( Just kidding! )

PupGeek, I`m curious... How are you setting the paths before running the apps.?

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#23 Post by sunburnt »

Addendum to PupGeek; I ask because the paths can be used to actually replace older or incompatible dependencies that exist in the system!
If the existing paths come after the added ones pointing to the SFS, then the SFS dirs. are searched first and the files needed are found.

This is of course if you run the app. with a startup script that sets the paths.
Then the paths that are set for each SFS file are unique to it alone, so the main system paths do not grow to huge sizes, and also you don`t have to edit the main paths constantly, you just make new ones.

PupGeek
Posts: 353
Joined: Sun 06 Sep 2009, 11:30

#24 Post by PupGeek »

When I package the .sfs into a roxapp, I use the AppRun script to check if the sfs is mounted, mount the sfs if needed, set the PATH and LD_LIBRARY_PATH variables, and finally execute the program.

As I said, I am basically using a roxapp as a wrapper for a .sfs file. Keep in mind, that all a roxapp is is a directory with an executable script named AppRun, and maybe a .DirIcon image. I haven't really tried this with pre-packaged .sfs modules, I have only used ones I made myself.

Here is an example of the AppRun I use for my Blender Roxapp:

#!/bin/sh

# This section checks for a directory that Xorg_DRI would install
# and installs it if it is not found. Then it runs xorgwizard.
if !( [ -d /usr/X11/lib/dri ] )
then {
gxmessage -timeout 5 "OpenGl was not found. Please wait while OpenGl is installed"
BLSFSDIR=/root/my-roxapps/blender
mkdir /mnt/blender
rxvt -e mount -t squashfs -o loop $BLSFSDIR/blender.sfs /mnt/blender
gxmessage -timeout 2 "Installing OpenGl... please wait"
cp -ur /mnt/blender/X11R7 /usr
gxmessage "Running Xorg Video Wizard, please save all work then press ok to continue"
gxmessage -timeout 5 "Please select XorgWizard from next dialog or close dialog to cancel. You can run blender from the menu after X restarts"
if !( [ -f /usr/share/applications/Blender.desktop ] )
then
cp /mnt/blender/share/applications/blender.desktop /usr/share/applications
fi
xorgwizard
}
fi

# This section checks to see of the .sfs file has been mounted
# and mounts it if necessary. This one also checks if there is a
# .desktop file in /usr/share/applications and copies it there if needed.
if !( [ -f /mnt/blender/bin/blender ] )
then {
BLSFSDIR=/root/my-roxapps/blender
mkdir /mnt/blender
rxvt -e mount -t squashfs -o loop $BLSFSDIR/blender.sfs /mnt/blender
gxmessage -timeout 3 "Configuring Blender. You can run Blender from the menu next time."

if !( [ -f /usr/share/applications/Blender.desktop ] )
then {
cp /mnt/blender/share/applications/blender.desktop /usr/share/applications
fixmenus
jwm -refresh
jwm -restart
}
fi

gxmessage -timeout 5 "Blender is configured and will now start"
}
fi

# Here is where we set the paths. These paths only seem to be valid
# within the program, but they are reset every time the program is
# started anyways.
BLENDERDIR=/mnt/blender
export BLENDERDIR

PATH=$BLENDERDIR/bin:$PATH
LD_LIBRARY_PATH=$BLENDERDIR/lib:$LD_LIBRARY_PATH


# Here, of course is where we execute the program.
exec $BLENDERDIR/bin/blender

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#25 Post by sunburnt »

Looks good PupGeek; I think that the paths would need to be exported, but maybe not.

I wrote a general purpose script that runs the app. exec. given to it.
Then any special needs that the app. has can be done in the SFS`s script.
It takes the paths from $PATH and adds the SFS file mount point on to them.
Then it checks if the new path exists in the SFS file and removes it if it doesn`t.
This way the code to do this (and more) isn`t duplicated for every app. and SFS file.

There`s no doubt in my mind that this is the correct way to use SFS files.
Mount but don`t union them, and selectable auto. menus and DT icons.

PupGeek
Posts: 353
Joined: Sun 06 Sep 2009, 11:30

#26 Post by PupGeek »

Ive noticed that even if i export the paths, the appendages are still only valid within the program for some reason... It really hasn't been a big deal to me so far.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#27 Post by sunburnt »

Yep... $PATH is inherited from the script that runs the app.
The new PATH is only good to the script that set it and it`s children,
but not the parents of the script ( main $PATH ). It`s handed down not up.

rexterd
Posts: 12
Joined: Wed 01 Oct 2008, 06:08

#28 Post by rexterd »

I am using aufs2 that can layer/detach sfs on the fly using gtkdialog3

http://picasaweb.google.com/rexterd/Lin ... 9359479890

PupGeek
Posts: 353
Joined: Sun 06 Sep 2009, 11:30

#29 Post by PupGeek »

I think roxapps are the bomb... That way, when building packages and dealing with dependencies, you can just add them to the roxapp directory instead of your system directories (this helps big time in case you place a dependency that is compiled for the wrong glib version or something like that, which will screw up your system if placed in a normal location). Also, you don't have to worry about the constant mount/union of .sfs mods either. Although sunburnt seems to have something good going on too.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#30 Post by sunburnt »

Again the forum didn`t email me that this thread had progressed, same with other threads...
I`m hoping jrb will join us here for more discussion...

This is an embedded script called "sfs-nounion" that goes into the root dir. of the SFS file:

Code: Select all

#!/bin/sh
##########	This is a setup file for: Mount SFS file but no-union.

###	USAGE:	sfs-nounion (-l , load | -u , unload) (/path/sfs-mount-dir.)

if [ -z "$2" ];then exit ;fi
sfsMNT=`echo $2 | sed 's#/$##'`						# make sure no trailing /
MENU='/usr/share/applications/mediainfo-gui.desktop'

if [ "$1" = '-l' -o "$1" = 'load' ];then			# add to paths & make links
 PATH=$PATH':$sfsMNT/usr/bin'
 LD_LIBRARY_PATH=$LD_LIBRARY_PATH':$sfsMNT/usr/lib'
 ln -s $sfsMNT$MENU $MENU
elif [ "$1" = '-u' -o "$1" = 'unload' ];then		# remove paths & links
 PATH=`echo $PATH | sed 's#:$sfsMNT/usr/bin$##'`
 LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed 's#:$sfsMNT/usr/lib$##'`
 rm -f $MENU
fi
There was only one PATH and LD_LIBRARY_PATH to add for this app.,
and one link for the menu file. There were no config. files to copy.

This is the same code that a "Load SFS" utility uses, but this way any
Linux system can use the SFS file, full or frugal installs, unioned or no-union.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#31 Post by sunburnt »

I also suggested a ram disk layer be added to the union to hold the SFSs config. files and links.
The basic setup:

Code: Select all

Layer #1: Save file
Layer #2: Ram disk
Layer #3: Added SFSs
Layer #4: Boot SFS
The ram disk layer doesn`t interfere with the Save file, but is on top of the other union layers.
It`s another level of complexity that arguably isn`t needed, but it keeps the Save file clean...
Copying config. files and making links is then done through the ram disk`s mount point, not /.

I don`t like having a union at all, so this isn`t my preferred way of doing no-union SFS files.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#32 Post by jrb »

Hi Guys,
Sorry to be so inattentive. I had no idea anything was happening on this thread. I depend on the forum to notify me and, it hasn't.

Let me just point out that I have posted a new SFS_Linker-431bk-1.0.pet in the additional software thread based on the work I started here. Its designed specifically to be an addon to Puppy431.

I've been using it for over a week and it is performing flawlessly, although a few SFS's have required tweaking to get them working.

I'm just heading out for the evening but tommorrow I'll try to come up to speed on the conversation going on here.

Thanks sunburnt for letting me know, J

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#33 Post by jrb »

Here's a summary of what SFS_Linker-431bk-1.0.pet does:

SFS_Linker has 4 basic parts:
1.)sfs_boot_handler
2.)sfs_linker
3.)sfs_unlinker
4.)sfs_remove.sh

1.)sfs_boot_handler:
sets up 19 new loops in Puppy431 so up to 24 SFS's can be mounted.
identifies and creates symlinks in /root/my_links/sfs_mnt_home to either SFS4 or SFS3 depending on the kernel
removes any SFS links left from last work session
loads any SFS's linked into /root/my_links/sfs_boot_links

2.)sfs_linker
checks to make sure SFS chosen is proper type
mounts the SFS to /mnt/$SFSNAME
checks to make sure it mounted properly by looking for /mnt/$SFSNAME/usr
renames seamonkeys /root/.mozilla if the SFS contains /root/.mozilla
creates a symlink from each file in /mnt/$SFSNAME to /$FILEPATH
copies any special need files from /mnt/$SFSNAME/choice to /$FILEPATH
creates a text file, /root/.packages/$SFSNAME.files
adds an entry to /root/.packages/user-installed-packages
adds lines to etc/ld.so.conf listing the standard, i.e. /mnt/$SFSNAME/usr/bin, lib_paths in the SFS then runs ldconfig (included in .pet) to add them to lib_path
creates a symlink to the SFS in /root/my_links/sfs_loaded
makes any new fonts available with mkfonddir

3.)sfs_unlinker
unmounts the SFS
checks to make sure it unmounted properly, quits and gives error message if not, SFS will be unlinked at next bootup in this case.
calls sfs_remove.sh to delete all symlinks to the SFS
removes the lib_path lines from /etc/ld.so.conf
removes empty folders from all except /root, /tmp, /var, /mnt
fixmenus and restart jwm

4.)sfs_remove.sh
uses code from puppy package manager to remove the symlinks listed in /root/.packages/$SFSNAME.files

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#34 Post by jrb »

I have uploaded SFS_Linker-431bk-1.1.pet

This one creates a new loop if needed. I have had up to 30 SFS's installed at once. It creates new loops when you want to simply mount an SFS as well. I have had up to 50 SFS's mounted at one time. Doesn't seem to be any limit although common sense says there must be. :wink: Does away with having to put

Code: Select all

max_loop=28
in the config file or kernel line. Just uninstall 1.0 (if installed), install 1.1, reboot and use.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#35 Post by technosaurus »

I think the kernel may be limited to 255 loops unless patched. Maybe this has changed though?
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#36 Post by jrb »

I have uploaded SFS_Linker-no_def-1.1.pet which does not have modified /usr/local/defaultprograms for people who wish to have SFS_Linking without changing the desktop icon or MIME-type behavior.

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

Suggestion

#37 Post by Béèm »

I just discovered SFS file linker and found it useful.
I have following suggestion:
When a sfs is loaded, it would be nice that in the file list in rox this is indicated somehow.
f.e. by another icon in the list or by another color of the file name.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
clarf
Posts: 613
Joined: Wed 13 Jun 2007, 19:22
Location: The old Lone Wolf

#38 Post by clarf »

technosaurus wrote:I think the kernel may be limited to 255 loops unless patched. Maybe this has changed though?
You are right technosaurus, the default value for Puppy kernel is a limit of 7 loop devices, that can be changed in boot as jrb says up to 255. The total limit for kernel without any patch is 255 loops.

I Don`t know if Barry updated the configuration made to recent kernels and changed the default "7" value.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#39 Post by jrb »

Beem wrote:When a sfs is loaded, it would be nice that in the file list in rox this is indicated somehow.
Hi Beem, Just tried out dpup-beta5. Very Nice! In my limited testing (5 sfs's) SFS_Linker1.1-no-def worked very well although the My_Links folder on the desktop looks pretty lonely.

If you open the My_Links folder and then the sfs_loaded folder you will see a list of all the sfs's that are presently loaded (by SFS_Linker, not by boot manager). You can unload them from here as well.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#40 Post by jrb »

clarf wrote:the default value for Puppy kernel is a limit of 7 loop devices
I have just tried SFS_Linker-431bk-1.1 with pup-431-k2.6.21.7-scsi-intel_modems_1.iso.
Sadly I have not been able to get past the 7 loop barrier. :(

I have tried the maxloop=28 entry in the kernel line to no avail. Also I tried an entry in /etc/modeprobe.conf with no success.

If anyone has an idea how to get past this 7 loop barrier please let me know.

Oh well, even 7 file mount points isn't too bad. Just have to do more unmounting. :wink:

Update: I have just tried the above puppy on my work computer I mounted a quick 20 sfs's and no problems with the 7 loop barrier. Must be something happening with my home computer - more detective work. :?
Last edited by jrb on Fri 04 Dec 2009, 21:24, edited 1 time in total.

Post Reply