loadAndUnloadBranchDirs.sh - to the aufs stack
loadAndUnloadBranchDirs.sh - to the aufs stack
I have attached a simple script called 'loadAndUnloadBranchDirs.sh', that can Insert and Remove directories as branches of the aufs stack.
It takes a single parameter, the full path to the directory.
If the directory is not already in the stack, it is inserted, else it is removed.
It's a hacked down version of a simple script to Insert and Remove sfs files in the aufs stack, that I copied from this forum back in 2013.
(Unfortunately I did not keep a record of who the author was.)
This is mostly my continued exploration of what's possible when using ordinary directories in the aufs stack.
However it might be useful while developing an sfs file. You can try the directory without having to actually create the sfs file.
Note: It's a simple script so it only does "fixmenus" processing. It ignores other things like fonts etc..
Edit1: Depends on 'lsaufs'. (no longer true.)
Edit2: Uploaded new version. Dependence on 'lsaufs' has been removed.
Edit3: Uploaded new version with 2 fixes, see post below.
gyro
It takes a single parameter, the full path to the directory.
If the directory is not already in the stack, it is inserted, else it is removed.
It's a hacked down version of a simple script to Insert and Remove sfs files in the aufs stack, that I copied from this forum back in 2013.
(Unfortunately I did not keep a record of who the author was.)
This is mostly my continued exploration of what's possible when using ordinary directories in the aufs stack.
However it might be useful while developing an sfs file. You can try the directory without having to actually create the sfs file.
Note: It's a simple script so it only does "fixmenus" processing. It ignores other things like fonts etc..
Edit1: Depends on 'lsaufs'. (no longer true.)
Edit2: Uploaded new version. Dependence on 'lsaufs' has been removed.
Edit3: Uploaded new version with 2 fixes, see post below.
gyro
- Attachments
-
- loadAndUnloadBranchDirs.sh.gz
- gunzip it to produce the script file
- (676 Bytes) Downloaded 259 times
Last edited by gyro on Mon 25 May 2015, 14:29, edited 1 time in total.
Updated script
I have uploaded a new version of the attached script.
The significant change is that the dependence on my 'lsaufs' script has been removed.
See first post for download.
gyro
The significant change is that the dependence on my 'lsaufs' script has been removed.
See first post for download.
gyro
Updated script again
This version of the attached script contains 2 fixes:
1) It checks that the specified directory resides in a Linux partition.
2) It checks that the specified directory is not the parent of an existing branch.
For download, see first post.
gyro
1) It checks that the specified directory resides in a Linux partition.
2) It checks that the specified directory is not the parent of an existing branch.
For download, see first post.
gyro
lol ..just realised that was my script...though it in itself is sort of hacked from how its done in SLAX Its been tidied a bit since then ..mainly for loading to tmpfs purposes.## insert branch directory...note if already there, will not try and insert...probably a good thing
Actually for practical usage this thread might help... http://www.murga-linux.com/puppy/viewtopic.php?t=99388
ie my suggestion that a folder on a partition could be inserted into the union for use as a shared config ..eg /root only. Harking back to the puppy one days when only /root was saved knoppix style.
did you ever read the stuff about union-fuse that we played with... my thought for that involved using sfs with full installs without having to unpack/symlink/install?
mike
Good question ..suck it and see I guess.... though a clue might be in pupmode=13 since that writes to the save file which is not the top rw layer.
I deleted all that stuff years ago but knowing puppy I cannot see the save file being removed from the union in order to do so.
My feeling is that there has to be at least ONE rw layer..indeed it won't allow otherwise, but more than one might just be fine.
For a test I unioned several sfs files as a space saving way to merge them..ie all you have to do is mksquashfs the union mount point...saves all that wasteful unpacking and fast too. All done via command line so just play with the parameters...the key line is in the script above.
After all thats how puppy works.... just variations on a theme.
mike
I deleted all that stuff years ago but knowing puppy I cannot see the save file being removed from the union in order to do so.
My feeling is that there has to be at least ONE rw layer..indeed it won't allow otherwise, but more than one might just be fine.
For a test I unioned several sfs files as a space saving way to merge them..ie all you have to do is mksquashfs the union mount point...saves all that wasteful unpacking and fast too. All done via command line so just play with the parameters...the key line is in the script above.
After all thats how puppy works.... just variations on a theme.
mike
Code: Select all
How cool would that be? Layering a ubuntu ful install on a puppy linux.
More up to date...so read/write works ok then?
mike
Yes unload only fails on the 2.6.18 kernel....anything later seems fine.
so the read test...do it do it....
actually I see a problem with using this for shared configs... only the top layer will get written to anyway unless you use snapmerge to copy changes down to the shared layer...and thats horrible stuff....if the quirks of that script are tolerable I suppose it could still work.
In other words it would be like PUPMODE=13 but using a common folder instead of a save file/folder...indeed modifying that mode would do...not my cup of tea though. And we are considering just /root rather than the full tree to make it configs only....hmm ok now its getting tricky....cannot union a folder back on itself.
Unless someone improves snapmerge..which is possible....and make it ONLY merge /root.
mike
so the read test...do it do it....
actually I see a problem with using this for shared configs... only the top layer will get written to anyway unless you use snapmerge to copy changes down to the shared layer...and thats horrible stuff....if the quirks of that script are tolerable I suppose it could still work.
In other words it would be like PUPMODE=13 but using a common folder instead of a save file/folder...indeed modifying that mode would do...not my cup of tea though. And we are considering just /root rather than the full tree to make it configs only....hmm ok now its getting tricky....cannot union a folder back on itself.
Unless someone improves snapmerge..which is possible....and make it ONLY merge /root.
mike
I would not expect write to work via aufs, since the branch is added "ro".stemsee wrote:Read is fine and so too unload using yad directory selector. I didn't try write yet.
Of course outside aufs, it's just a directory.
Aufs documentation suggests that it does support multiple "rw" layers, so the script could be modified to add the branch "rw", but getting aufs to write the appropriate stuff to the appropriate layer might be a challenge.
gyro
Last edited by gyro on Mon 01 Jun 2015, 07:18, edited 1 time in total.
Well thanks for your script mikeb.mikeb wrote:lol ..just realised that was my script...though it in itself is sort of hacked from how its done in SLAX Its been tidied a bit since then ..mainly for loading to tmpfs purposes.
Yes interesting, I was just exploring what is possible, unaware of some of this other stuff.mikeb wrote:Actually for practical usage this thread might help... http://www.murga-linux.com/puppy/viewtopic.php?t=99388
ie my suggestion that a folder on a partition could be inserted into the union for use as a shared config ..eg /root only. Harking back to the puppy one days when only /root was saved knoppix style.
No.mikeb wrote:did you ever read the stuff about union-fuse that we played with... my thought for that involved using sfs with full installs without having to unpack/symlink/install?
gyro
I don't quite understand "If ram permits", the directory does not get copied into memory.stemsee wrote:I ram permits one could load an entire partition full linux install as a layer! just by selecting /mnt/sda2 for example. How cool would that be? Layering a ubuntu ful install on a puppy linux.
gyro
Hi gyro...not intended as a thread hijack but seemed open for related ideas.
union-fuse does what aufs does but using fuse..surprised huh...
it was being used in my case as a way of mounting an sfs over a full install .... the method being to create the layers onto new folders somewhere and then chroot into them to run the sfs...not 100% on why aufs could not do it but there was probably a good reason..amigo suggested it originally.
Yes you see having an extra rw layer can be done but how would it be used is the problem,...selective snapmerge was my only thought.
mike
union-fuse does what aufs does but using fuse..surprised huh...
it was being used in my case as a way of mounting an sfs over a full install .... the method being to create the layers onto new folders somewhere and then chroot into them to run the sfs...not 100% on why aufs could not do it but there was probably a good reason..amigo suggested it originally.
Yes you see having an extra rw layer can be done but how would it be used is the problem,...selective snapmerge was my only thought.
mike
@amigo,
You say aufs supports only 1 writable layer, the actual aufs documentation says it supports multiple writable layers.
@mikeb,
pupmode=13 has only 1 writable layer. "snapmergepuppy" script writes to the save-layer by accessing the directories directly, outside aufs.
@stemsee,
If you want to do auto-loading, you could consider adding a line to run your script after the following line in "rc.sysinit"
gyro
You say aufs supports only 1 writable layer, the actual aufs documentation says it supports multiple writable layers.
@mikeb,
pupmode=13 has only 1 writable layer. "snapmergepuppy" script writes to the save-layer by accessing the directories directly, outside aufs.
@stemsee,
If you want to do auto-loading, you could consider adding a line to run your script after the following line in "rc.sysinit"
Code: Select all
[ -d /initrd ] && [ -x /etc/init.d/sfs_load ] && /etc/init.d/sfs_load start