Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 19 May 2013, 00:22
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How can i check if sfs is loaded?
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [30 Posts]   Goto page: Previous 1, 2
Author Message
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Fri 06 Apr 2012, 23:07    Post subject:  

Bruce B wrote:
# it is also fairly well formatted.

Code:
/dev/loop0:  (/initrd/mnt/dev_save/520/lupu_520.sfs)
/dev/loop1:  (/initrd/mnt/dev_save/520/lupusave.3fs)
/dev/loop2:  (/mnt/sda8/spotd.3fs)
/dev/loop3:  (/mnt/sda8/winehq.3fs)
/dev/loop4:  (/initrd/mnt/dev_save/520/extras.sfs)
/dev/loop5:  (/initrd/mnt/dev_save/520/lupu_devx_520.sfs)


Yes, well formatted. But you can not always use that well formatted paths to get access to files inside a mounted (not loaded) sfs using bash.

I do solve this problem the following way. Maybe someone would find an easier solution.

Once i do know the original name and path of the sfs file i do this:
Code:

# basename of $ORIGFILE
SFSFILE="$(basename "$ORIGFILE")"

# open rox and mount the sfs
rox "$ORIGFILE"
# write original path to sfs to temp file
echo 'MNTORIGFILE="'$ORIGFILE'"' > /tmp/$SFSFILE.mnt_tmp

# replace all "/" in path with "+"
sed -i 's|/|+|' /tmp/$SFSFILE.mnt_tmp
fnd="true"
while ($fnd = "true") do
   if (grep "/" /tmp/$SFSFILE.mnt_tmp) then
      sed -i 's|/|+|' /tmp/$SFSFILE.mnt_tmp
      else
      fnd="false"
   fi
done

# replace "+mnt+home" with "+initrd+mnt+dev_save"
# needed if using save file (pupsave)
if (grep "+mnt+home" /tmp/$SFSFILE.mnt_tmp); then
   sed -i 's|+mnt+home|+initrd+mnt+dev_save|' /tmp/$SFSFILE.mnt_tmp
fi

. /tmp/$SFSFILE.mnt_tmp # get new mounted path
echo $MNTORIGFILE/$SFSFILE
sleep 1 # just wait to be sure, sfs is full mounted
rox -D "/mnt/$MNTORIGFILE" # close rox window



After this point of the script the sfs stays mounted and i can do what i want using bash and the sfs included files (except writing into the sfs).

For an example:

If i do already know the name of an icon listed at the icon entry in a .desktop file inside this sfs, i can copy this icon out of the sfs file into the running system (using bash). Cool

Code:
cp -a /mnt/$MNTORIGFILE/usr/share/pixmaps/$Icon /usr/share/pixmaps/$Icon


To umnount the sfs after the work is done i do call
Code:
rox "$ORIGFILE"

again. That's it.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4001
Location: Arizona, U.S.A.

PostPosted: Sat 07 Apr 2012, 00:22    Post subject:  

I used the + to replace / in Puppy`s utility "filemnt"
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sat 07 Apr 2012, 00:41    Post subject:  

sunburnt wrote:
I used the + to replace / in Puppy`s utility "filemnt"


I found this stuff while working on a suggestion in the german forum, which will be a new feature of the next LazY Puppy. It then wil be used as basic OS for a PhyTech Linux and some other remasters by der-schutzhund.

Short Story:

I do a rightclick on a sfs. Then a GUI comes up with a list of the .desktop files. I chose one, or more or all files and click Ok. Then it creates run-scripts for each selected program. Also it copies the used icon into the system (where the run-scripts are saved).

Clicking on a created run-script will run the program. If the sfs is not loaded, it will first load the sfs. If the sfs needs another sfs, it will load this one also. If the dependent sfs's do have dependencies, it will load them as well. After all sfs files are loaded, the program runs. While the user is sunken in his work, using already the program there will be just one time of calling the fixmenus (just in background) Laughing

This has also been possible because of shinobars new sfs_load-1.9. He did include a suggestion of mine, that allows users to call sfs_load and fixmenus at different stages and using a list.

My first solution did work by using puppy without using a save file (pupsave) but not if using a save file. My second solution did not work not using a save file but did work using a save file. So i did just check, if +mnt+home is in the path. If, then change it. Now it works in both way of use.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sat 07 Apr 2012, 18:00    Post subject:  

sunburnt,

After sitting up all night thinking about, I think the losetup-FULL output is accuate. I'll explain how.

While puppy is assembling its layered file system /initrd actually is /

Later after things are mounted, Puppy performs a switch_root and sets up a new /


find a line something like below inside file init
#SETUP SWITCH TO MAIN FILESYSTEM#
echo -n "Performing a 'switch_root' to the layered filesystem..." > /dev/console

then look at the commands which follow

So, according to my theory, losetup records the true location of the .sfs and .3fs files which are mounted before the switch_root. The switch_root changes the root (meaning the location of /) and the losetup path doesn't change simply because a switch_root was made.

(1) I hope I made this post understandable, (2) I think it is true and hope it is. :)

~

Bruce

Also, regarding your use of the sed command. Thanks. I've been escaping special characters with a \

It appears to me your use of the #string of characters# causes a literal character interpretation by sed. Anyway, it is an easier way to feed sed characters when there are special characters which would otherwise need to be escaped. Thanks.

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sat 07 Apr 2012, 20:02    Post subject:  

RSH wrote:
. . . But you can not always use that well formatted paths to get access to files inside a mounted (not loaded) sfs using bash. . . .


I don't want to make you wrong or even say you are mistaken. I don't recall having that experience.

But then again, you used the word always. Always is a strict criteria and something I could never test for.

For a couple of examples,

ls | tr "\n" " " both ls and tr are inside an .sfs file. ls is a file and tr is a symlink. If the command works then both the file and the symlink were accessed.


cp /bin/ls /bin/tr /tmp copies the file and symlink to /tmp and if it works we have proof of successful access.

ls -l /tmp will verify the success of the above read / copy operation.

Always is a condition I would not know how to test.

Some commands I cannot perform inside the virtual tree. I might need to do it from inside /initrd. A specific example is chattr. Even at that it doesn't modify the file inside the .sfs, rather makes a change in the pupsave file which overrides the .sfs file.

Also, I don't understand what you mean in terms of difference between a mounted and loaded .sfs file. Can you explain?


Other thoughts or examples?

Bruce

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sat 07 Apr 2012, 23:32    Post subject:  

Ok, i will try to explain, but i think i will fail again, because i do know, i have to polish up my english knowledge. I am just trying to recall my long year ago english experience. You surely know: it's really hard to do the whole work (programming in a new language, posting questions & suggestion etc.) using a foreign language - and also being an newbie to linux..

I do know, on my problems always (there it is again) to find the right words and/or syntax. Sad

Ok:

Mount - clicking on a sfs, rox opens and i do get access to the sfs's data, but can not run the programs

Load - like sfs_load, getting acces to data and the use of (run) the programs

"not always" - in one case it works, in the other case it doesn't

Without pupsave the path is : /mnt/sdd1/lazy
Using pupsave the path is /mnt/home/lazy

Without pupsave the the path of a mounted sfs changes to /mnt/+mnt+sdd1+lazy
Using pupsave the path of a mounted sfs changes to /mnt/+mnt+home+lazy

I do mount the sfs using rox "$ORIGFILE". $ORIGFILE is the name of the sfs (including its pathname)

If i use /mnt/+mnt+home+lazy/xxx (xxx is the path to a file inside the sfs) i do not getting access to the data. I can not use cp to copy a file out of the sfs into the system. I have to change +mnt+home to +initrd+mnt+dev_save. Then i can use cp.

Using the sequence(?) +initrd+mnt+dev_save gives acces to the data inside the mounted sfs in both cases (using pupsave and not using pupsave)

We (my suggester, supporter, tester and myself) di test it several times, because i was confused on that fact, the application does run on my system (i do work to 100% without pupsave on my home workstation) and does nothing on Wolfgangs (der-schutzhund) computer. Did need some time to come to the knowledge of the differences in our ways to use my LazY Puppy. He works always (and again) using pupsave.

The sequence +initrd+mnt+dev_save did solve the whole thing and made the application running (andworking) in both cases/ways.

I think, making more words might make you again "confused", so i will send you my rightclick application to improve the whole thing. It will be easy to improve just by commenting out one single line of code and then running the application two times (twice?) one time (once?) -without pupsave (i call this mostly save file)- and one time (once again?) running the application using a pupsave (then it will run straight through its code without doing anything of the wanted job).

But it needs a bit of time, because i do use this in modified sfs files, which means, the sfs contains a text file. If this does not exist, the application does nothing. So i have to remove this parts or comment them out, first.

But i will send as soon as possible; unfortunately i have to go to bed now. I am working today about 39 hours in a row and therefor i am currently not able to do any more coding.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4001
Location: Arizona, U.S.A.

PostPosted: Sun 08 Apr 2012, 01:03    Post subject:  

RHS; Rox does weird things, I use scripts.

Bruce B; Your explanation sounds plausable for Puppy.

Whatever character comes after the 's is the separator.
Or for other sed commands the character after sed '
I`ve seen | used but it`s the pipe operator.
% also works but it seems confusing to look at.
Many others work also but I stick with # .
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sun 08 Apr 2012, 01:22    Post subject:  

sunburnt wrote:
RHS; Rox does weird things, I use scripts.

Yes, i do use also a script. rox "$ORIGFILE" is a command inside the script i do use for the whole thing. That's how i mount the sfs on the running scipt (hope, you got me now?). I do not click on the sfs in rox to mount it.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sun 08 Apr 2012, 01:49    Post subject:  

RSH wrote:
Ok, i will try to explain, but i think i will fail again, because i do know, i have to polish up my english knowledge


First and foremost, I appreciate anyone's limitations with English. If someone wanted me to learn German, I'd probably try and find a way out of doing it.

English is even hard for many if not most Americans. First of all, we don't know how to speak the Queen's Language, it is even hard for us to understand when spoken to.

In other words, the difference between the spoken UK English and its accents and dialects and American English is a hurdle to overcome.

Then we have idiomatic expressions where words are not to be taken in any literal matter.

For a simple example, "You're pulling my leg", cannot be understood literally, but it has meaning all the same for those of who understand it. It is a polite way of saying, "I don't believe you."

English seems to have as many exceptions as rules.

Also, I don't always know how to spell words I hear. Also, how to pronounce words I read. It is not a fully phonetic language.

Back to the subject. Do you know how the path statement affects whether or not we can run programs by name or need to access them by full or relative path.

Suppose I want to run a program not in the path statement. Suppose I'm in my home directory, /root.

I might need to say on the command line.

/mnt/sfs/bin/filename

or

../mnt/sfs/bin/filename

If it were in the path statement, I would only need to say

filename


I don't wish to imply I think you don't understand this already, but if it is not understood, things can be confusing.

Bruce

~

PS

I thought I'd add that I never actually understood many of the mechanics of English until I studied and learned Spanish.

I decided that the secret of really grasping a language is understanding the verb system.

How can one say in Spanish using only one word and in English we need three words?

Spanish: haré

English: I will do

Learning a better designed verb system, helped me to better understand the more clunky English verb system.

English in my opinion is not a very pure language. It is a hodgepodge of many other and sometimes not very related languages.

For an example:

House - comes from German I suppose

Mansion - comes from French I suppose

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sun 08 Apr 2012, 01:59    Post subject:  

RSH wrote:
sunburnt wrote:
RHS; Rox does weird things, I use scripts.

Yes, i do use also a script. rox "$ORIGFILE" is a command inside the script i do use for the whole thing. That's how i mount the sfs on the running scipt (hope, you got me now?). I do not click on the sfs in rox to mount it.


In DOS I loved Norton Commander. In Windows I like the Total Commander.

In Linux I took to the Midnight Commander as my choice file manager.

See: http://www.gnu.org/software/mc/

Because I don't use ROX-Filer much, I don't know it intimately.



~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sun 08 Apr 2012, 02:05    Post subject:  

sunburnt wrote:
RHS; Rox does weird things, I use scripts.


sunburnt, here is my script for mounting .sfs files

At first glance it may look more clunky than necessary. It isn't really so cluncky because it works around occasions where there is an orphaned loop device.

Code:
#!/bin/bash

[ ! $1 ] && echo "Need filename for argument" && exit
[ ! -f $1 ] && echo "$1 not found" && exit

lodev=`losetup-FULL -f`
# echo $lodev
losetup-FULL $lodev $1

if [ $2 ] ; then
    mount-FULL -t squashfs -o ro $lodev $2
else
    mount-FULL -t squashfs -o ro $lodev /mnt/sfs
fi

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sun 08 Apr 2012, 02:53    Post subject:  

Quote:
"You're pulling my leg"

In Germany we would say: "Du willst mich wohl auf den Arm nehmen?

Quote:
Because I don't use ROX-Filer much, I don't know it intimately.


Code:
rox "$ORIGFILE"

This is pizzasgood's code! Laughing

I did learn my first bash lessons from his code and wrote the initrd.gz GUI
http://murga-linux.com/puppy/viewtopic.php?p=581371#581371
using pizzasggoods code to extract and rebuild the initrd.gz.

So i did choose this --> rox "$ORIGFILE" <-- becaue: hey - he is pizzasgood. Is there a need to say anything else?

I think he does use this in his edit-sfs application. Question

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sun 08 Apr 2012, 03:07    Post subject:  

[quote="RSH"]
Quote:
"You're pulling my leg"

In Germany we would say: "Du willst mich wohl auf den Arm nehmen?

I certainly would never have guessed, does the use so many words result in a very polite statement?

I think the safest and most polite way I've found in communicating disbelief is: "Hmmm. Maybe you're right."

If he comes back and says, "Absolutely, I'm right." (which I've not experienced).

I can reply, "Maybe so."

The reason why all the work is when I really don't want to pretend belief. In most cases, I don't want to offend either.

~~~~~~~~~~~~~


I also borrowed from Pizzasgood the same initrd commands and re-wrote it with features.
Quote:

I think he does use this in his edit-sfs application. :?:


I didn't know there was this app or something similar. I use a standard text editor. To search and return, I sometimes use a helper unique comment of my own in the file.

Doing significant modifications can be a daunting task. Requires special care.

~

Bruce

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Sun 08 Apr 2012, 03:09    Post subject:  

RSH wrote:

I did learn my first bash lessons from his code and wrote the initrd.gz GUI
http://murga-linux.com/puppy/viewtopic.php?p=581371#581371


I see this has been downloaded many times with no complaints or bug reports. Well done.

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sun 08 Apr 2012, 03:40    Post subject:  

Bruce B wrote:
I certainly would never have guessed, does the use so many words result in a very polite statement?

Yes, it does. But that's not all. It also is really a question and mostly used with a laugh after saying and/or a smile. So, it can take out (away?) a lot of pressure of such situation (not to believe somebody). Laughing

Bruce B wrote:
I see this has been downloaded many times with no complaints or bug reports. Well done.

Thanks!

So, i see, i wanted to go to bed several hours ago. No i do.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [30 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1014s ][ Queries: 12 (0.0054s) ][ GZIP on ]