Mounting and Linking SFS files for use

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

jrb is mounting SFS files but not unioning them. So the topic is non-unions.
The OS may or may not be running a union, but it`s not being used for this.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#17 Post by seaside »

JRB,

I don't know whether you are still pursuing the "link" route over the "union" one, but I thought maybe one way to prevent any necessary installed files from being inadvertently removed by the Pet uninstaller is to test for "symlink files only" before removal.

"if not symlink file, don't remove" in the uninstaller code.

I realize there are many factors and tradeoffs between "linking" and "unioning" and perhaps "linking" might be a "safer" way.

How is your thinking going now?.

(I must make sure Choicepup stays healthy) :D

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

#18 Post by sunburnt »

Hi seaside; My suggestion to have a small ram disk as another union layer solves this problem.
All the links go into it and so doesn`t make a mess of the file system.

BUT... Setting the paths is most important, it eliminates most of the links!

jrb; You have been silent, are you still with us?
I`ll provide details of how to use the paths if you`re still at it... Terry

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

#19 Post by PupGeek »

@ sunburnt: I have been experimenting with using sfs files within a roxapp. This way the roxapp contains the script which mounts the sfs file and can copy any necessary files over. I have succeeded with one app thus far... Blender. I made it to contain all its dependencies as well as check for OpenGL and install it if necessary. I have uploaded it into the .pet store and I am waiting for it to be available.

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

#20 Post by sunburnt »

Hi PupGeek; I assume that you`re using this method of "mount but don`t union"?
If so... Why would you mess up the file system with copied files?

As to dependencies, I had wrote a script that runs an app. and if it errors,
it runs "ldd" on it to get library dependencies and then downloads them.
It could be expanded to include all types of dependencies for download.
This way any app. package or SFS file doesn`t need the dependencies.
All that`s required is a solid fixed web site to point to the download sites.
This way it acts as a clearing house for the dependency download sites,
so the download sites can come and go and the main site is just updated.

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].

Post Reply