sfs_load-2.4 on-the-fly

Miscellaneous tools
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#321 Post by Argolance »

Bonjour,
When trying to load an SFS file that is different but has the same name of an already loaded SFS file, SFS_load says this SFS is already loaded and asks user if he wants to unload it.
If user wants to load the new one and then to copy or to move it to /initrd/mnt/dev_save, SFS_load just says SFS file "was found" but does not allow user to choose if he wants to keep the old one or to overwrite it with the new one.
Is it silly or could the script be modified beneficially in this way? I tried to test/do this myself but am a bit afraid to break something so much the script is complicated for me :oops: .

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#322 Post by musher0 »

Bonjour Argolance.

It could be a simple matter of adding a check in the script for size and/or date of the
sfs file.

But I think it is Linux itself (and maybe all OS's) that cannot handle two files of the same
name at the same time. This is a good way to confuse the system, let alone sfs-load.
First trick explained in The Hacker's Book, I think.

A question, though: if you're using sfs-load and you get that message, does that means
that you have already and gleefully squished the existing sfs by the same name? :)

This situation happens every second month with java JRE for example :
someone does a new sfs for the new java JRE, we unload the old one and we load
the new one. Simple. But of course the javas don't have the same version number.

À plus tard.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#323 Post by Argolance »

Bonjour,
Thanks for replying, dear musher0 :wink:
musher0 wrote:cannot handle two files of the same name at the same time.
I obviously do not intend to let user load two sfs files with the same name at the same time (for that strange purpose - probably useless - it is enough to name both differently), just replace the "old" one by the "new" one, which should be loaded at next startup. When SFS file is already present in /initrd/mnt/dev_save, SFS_load doesn't replace the old one with the new one, it just says that SFS file "was found" but keeps the old one that will be loaded at next startup anyway. If user chooses not to copy/move the SFS file to /initrd/mnt/dev_save, so there is no problem because the SFS file is directly loaded from the Downloads directory and the new one will be loaded at next startup. If it could be possible with moved/copied SFS files, using a dialog box prompting user if he wants or not do the overwriting, I think it would be convenient.

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#324 Post by musher0 »

Hello again, Argolance.

Je crois que ç'a à voir avec les couches / I think it has to do with the layers.
and you can't change an active layer mounted at /initrd/pup_ro-something without
un-mounting it first.

This layer is active, so removing it while it is active would be like cutting the branch
you are sitting on. The system will not let you do it.

On the other hand,

Code: Select all

more /initrd/tmp/EXTRASFSS
will tell you which sfs's are loaded at the moment in your Puppy, therefore which sfs
you must unload before mounting the new sfs.

From that list, it should be possible to write a script to
  • -- compare the names of the sfs's
    -- unmount the old sfs and
    -- mount the new one directly --
carefully, possibly bypassing sfs_load entirely.
(Not sure about this "bypassing").

Just a thought. / Une idée comme ça.
It needs testing, validation, of course -- and probably multiple checks in the script
in order not to "break" your system.

Autrement tu te retrouveras le bec à l'eau. / Otherwise you'll be left high and dry.

À+

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#325 Post by Argolance »

[EDIT]
Bonsoir,
Thank you musher0.
This layer is active, so removing it while it is active would be like cutting the branch you are sitting on. The system will not let you do it.
:?: May be I am wrong, but you can delete a mounted SFS file and you will see that it will work properly during all the session because, as layer, it is not affected. The only difference is that it will not be mounted at next startup (with all the troubles this implies). Now, if you delete any file of the mounted SFS file with your file manager, Puppy will remember this and deleted files will not be present at next startup though the (new or old) SFS is duly mounted. Deletion affects the layer but not the SFS file itself (which is read-only anyway) and what could happen to the SFS file seems to be none of its business all long the session.
Autrement tu te retrouveras le bec à l'eau.
Not sure: I really think replacing an SFS with another one is possible while it is currently mounted (it is what my little experiment tends to "prove": I did it manually with my devx file and even with my main ToOpPy sfs file during all my tests and at next startup, as far as I know, all works fine). So, I admit I would like to have (also) the opinion of another "leading light" of the forum and learn, if "feasible", how to modify the SFS_load script properly, using some added command lines inside and with all the required precautions!

To sum up: I download a SFS file that has the same name as a SFS file present (loaded/mounted or not) in /initrd/mnt/dev_save. If I try to install/load the new SFS, 2 cases:
  • - if already mounted, SFS_load asks me if I want to unload it. So, I unload it, then I click the new one, choose "Install SFS", SFS_load says he found it, then doesn't load the new one but reload the old one.
    - if not loaded/mounted, SFS_load says he found it and so on... :(
I just would like the old one to be replaced by the new one and not to have to do it manually..

Suggestion: the button "Install SFS" should be labeled "Un/Install SFS" because user can uninstall/unload any SFS file this way too.

Cordialement.
Last edited by Argolance on Sun 23 Aug 2015, 09:34, edited 5 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#326 Post by musher0 »

Hello Argolance.

Moi, a "leading light" among Puppyists?! Wow, that really is flattery! You must have a
favor to ask me! ;) :D

I find you courageous to change the devx file "in vivo". I know that I wouldn't risk it! :)
If it works, bravo!

I did follow your reasoning, and I think it makes sense, but I am more conservative
than you are, so I'll stick with the traditional procedure for changing sfs's.

However, this may be of interest to you:

I remember that on another thread (mais lequel dans le capharnaüm du forum ! / but
which one in this mess of a forum! ) mikeb (I think) had found a way to change
pupsaves without exiting the Puppy. I guess that what you are seeking is along those
lines. If he could do it with a pupsave, why not with a regular sfs?

The trick, if I remember correctly, was to be in the main puppy sfs (probably in urxvt)
when doing the change. He had various pupsaves in the form of pup_rw directories
neatly stored on /mnt/home. He would erase the current /initrd/pup_rw and copy another
one in its place. And vroom, he had another flavor of the Puppy at his fingertips.

I don't know if this helps, but there you have it!

Bye for now / À+

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#327 Post by Argolance »

I find you courageous to change the devx file "in vivo". I know that I wouldn't risk it! Smile
If it works, bravo!
Je n'y suis pour rien: tout le mérite en revient à Puppy et son génial système de fichiers à couches! :wink:
I updated my post above to make my question more understandable.

No answer: silly/untoward question? :roll:

Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#328 Post by Argolance »

Hello,
No answer: silly/untoward question?
:cry:
Note: the suggestion above is about filemount and has nothing to do here with SFS_load.

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#329 Post by musher0 »

Ahem. That statement is illogical: the file system in the sfs file has to be mounted to
be of any benefit to the user.

Without filemount, no sfs. Oh, the sfs will exist, but as I said, it won't be of any benefit.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#330 Post by Argolance »

Suggestion: the button "Install SFS" [of filemount] should be labeled "Un/Install SFS" because user can uninstall/unload any SFS file this way too,

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#331 Post by ASRI éducation »

Argolance wrote:
Suggestion: the button "Install SFS" [of filemount] should be labeled "Un/Install SFS" because user can uninstall/unload any SFS file this way too,
This is done for several months.
https://github.com/puppylinux-woof-CE/w ... 3a067b4c00
https://github.com/puppylinux-woof-CE/w ... a30efa84d1
Regards,
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#332 Post by Iguleder »

There's a bug in sfs_load - it should obtain the numeric kernel version using `uname -r | cut -f 1 -d \-`. Otherwise, it doesn't work at all with kernels that have an extra version string.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#333 Post by ASRI éducation »

Iguleder wrote:There's a bug in sfs_load - it should obtain the numeric kernel version using `uname -r | cut -f 1 -d \-`. Otherwise, it doesn't work at all with kernels that have an extra version string.
Yes, need to replace:
KERNVER="`uname -r`"
by
KERNVER="`uname -r | cut -f 1 -d \-`"

Thank you.
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#334 Post by ASRI éducation »

sfs_load-2.3.3

I incorporated:
- sfs_load-2.3 (by shinobar)
- sfs_load-2.3.0 (by ASRI)
- sfs_load-2.3.2 (by mavrothal)
- improve kernel detection KERNVER (by Iguleder)

Regards,
Attachments
sfs_load-2.3.3.jpg
(47.22 KiB) Downloaded 915 times
sfs_load-2.3.3.pet
(34.12 KiB) Downloaded 412 times
Last edited by ASRI éducation on Sun 04 Oct 2015, 19:14, edited 1 time in total.
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#335 Post by musher0 »

ASRI éducation wrote:sfs_load-2.3.3

This version is based on:
- sfs_load-2.3 (by shinobar)
- sfs_load-2.3.0 (by ASRI)
- sfs_load-2.3.2 (by mavrothal)
- improve kernel detection KERNVER (by Iguleder)

Regards,
Hello, ASRI.

Sorry, I have to translate to understand... "Based on", you mean
"incorporates", right?

Also, if you could kindly look over the translation I made for 01micko's
change-kernels script. It's in that thread.

I translated to "international French", but I'd like to have an European
editor go over it, to make double sure there are no "canadianisms". If
you can't, that's fine, I'll ask someone else.

Thanks.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#336 Post by ASRI éducation »

musher0 wrote:Sorry, I have to translate to understand... "Based on", you mean "incorporates", right?
That's it.
Thank you for pointing that out, I'll edit my previous message.
musher0 wrote:look over the translation I made for 01micko's
change-kernels script. It's in that thread
I just do it, everything seems ok.

Regards,
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#337 Post by mavrothal »

As reported sfs_load in PUPMODE=5 fails to install as SFS saved in /tmp (ok when saved in other locations)
The problem is that the union (re)mount fails in this case. I think that this may be the expected behavior of aufs but it needs further investigation.
Till then the attached patch stops sfs_load from loading an SFS from /tmp or suggesting to copy it there when running in pupmode 5
The patch is against ASRI's 2.3.3 but should work in other versions too.

Code: Select all

--- a/usr/sbin/sfs_load	2015-10-04 15:25:30.000000000 +0300
+++ b/usr/sbin/sfs_load	2015-10-09 11:45:01.760463314 +0300
@@ -885,7 +885,7 @@
   local TOPPART="$1"
   # Offer RAM only if enough
   RAMPART=""
-  if [ "$FILEISAT" != "tmpfs" -a "$FILEISAT" != "ata" ]; then
+  if [ "$FILEISAT" != "tmpfs" -a "$FILEISAT" != "ata" -a "$PUPMODE" != "5" ]; then
    RAMPART=$(echo "RAM|($(gettext "Available"):$(kbyte2 $RFREE))"|tr ' ' '_')
    REST=$(($RFREE - $FILESIZE))
    if [ $REST -gt $RESERVRAM ]; then
@@ -1697,7 +1697,7 @@
       DIRNAME=$(dirname "$EXTRASFS")
       FILENAME=$(basename "$EXTRASFS")
       #if echo "$DIRNAME" | grep -qw '/tmp$' || [ "$(df "$DIRNAME" | tail -n 1 | cut -d ' ' -f1)" = "tmpfs" ]; then
-	  if [ "$(df "$DIRNAME" | tail -n 1 | cut -d ' ' -f1)" = "tmpfs" ]; then
+	  if [ "$(df "$DIRNAME" | tail -n 1 | cut -d ' ' -f1)" = "tmpfs" -a "$PUPMODE" != "5" ]; then
         rm -f "$EXTRASFS"
         RMLOG=$(printf "$(gettext "The temporary file '%s' is deleted.")" "$EXTRASFS")
         FOUND=""
@@ -1734,6 +1734,14 @@
 basename "$0" | grep -q '^un' && ACTION="unload"
 [ "$DISPLAY" != "" ] && GUI="y"
 basename "$0" | grep -q 'debug' && DEBUGFLAG="y"	# v1.3.9
+
+# Temp work around. Do not mount SFS from /tmp when running in pupmode 5
+. /etc/rc.d/PUPSTATE 
+if [ "$(echo $ORGOPT | cut -f2 -d/)" = "tmp" -a "$PUPMODE" = "5" ]; then
+  Xdialog --title "$(gettext 'Error')" --msgbox \
+   "$(gettext 'You can not install an SFS saved in the /tmp directory \nwhen running in PUPMODE=5')" 0 0
+ exit 0
+fi
 #v1.9.2: allow --skip-fixmenus with multiple files
  while [ "$1" ] ; do
   case "$1" in
Since the forum may add spaces at the end of the lines, it is also attached below.
Attachments
sfs_load.patch.gz
Patch to stop loading SFSs saved in /tmp when running in PUPMODE=5
(842 Bytes) Downloaded 337 times
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#338 Post by ASRI éducation »

mavrothal wrote:sfs_load in PUPMODE=5 fails to install as SFS saved in /tmp (ok when saved in other locations)
Thank you for the patch (sfs_load.patch.gz).
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

jplt

#339 Post by jplt »

Is there a way to launch an sfs file with this :

Code: Select all

sfs_load -c -q xxx.sfs
And then have a box that say "The software is launching" and then launch the software ?

I want to do this because i found annoying to click on x box to launch an sfs file .

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#340 Post by peebee »

jplt wrote:Is there a way to launch an sfs file with this :

Code: Select all

sfs_load -c -q xxx.sfs
And then have a box that say "The software is launching" and then launch the software ?

I want to do this because i found annoying to click on x box to launch an sfs file .
My script to load the wine sfs and then run irfanview called from a desktop file:

Code: Select all

#!/bin/sh 
# Purpose: To convert Linux-style filename to Windows-style 
# to pass as an argument to Irfanview within wine 

sfs_load -n -c wine.sfs

Filename=${1//\//\\} 
wine "C:\Program Files\IrfanView\i_view32.exe" "$Filename"

sleep 8
sfs_load -n -c -wine.sfs
sfs_load -n -c -wine.sfs &
You could add a yaf-splash message if you need one...
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

Post Reply