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 Tue 01 Sep 2015, 20:41
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
snapmergepuppy - gets branch directories from aufs
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
gyro

Joined: 28 Oct 2008
Posts: 792
Location: Brisbane, Australia

PostPosted: Mon 18 May 2015, 04:15    Post subject:  snapmergepuppy - gets branch directories from aufs  

This is a version of the "snapmergepuppy" script that does not rely on puppy default directory names to find the appropriate branches of the stack. It queries the aufs files in /sys to get them, so it works no matter what the directories are.

The advantage in a normal puppy is that when processing ".wh." files, it searches all the lower branches, and only the actual branches, no matter what they are called.

Of course it also works if the lower branches are ordinary directories rather than mounted sfs files.

Here is the patch against tahrpup 6.0.2:
Code:
--- snapmergepuppy.orig   2015-03-18 08:26:43.030087000 +1000
+++ snapmergepuppy   2015-05-15 13:42:36.359076293 +1000
@@ -57,19 +57,11 @@
 PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin"
 WD="`pwd`"
 
-SNAP="/initrd/pup_rw"
+SNAP="`cat /sys/fs/aufs/si_*/br0 | head -1 | cut -f1 -d'='`"
 cd $SNAP || exit 1
 
-if [ "$SAVE_LAYER" ]; then #defined in PUPSTATE
- BASE="/initrd${SAVE_LAYER}"
-else
- BASE="/initrd/pup_ro1"
-fi
-BASEMTP="`df-FULL --output=target "$BASE" | tail -1`"
-
-if [ -L $BASE ]; then #we have savefolder based on symbolic links
- BASE="`readlink -n -m $BASE`"
-fi
+BASE="`cat /sys/fs/aufs/si_*/br1 | head -1 | cut -f1 -d'='`"
+BASEMTP="`df-FULL --output=target \"$BASE\" | tail -1`"
 
 # Precautions
 [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ] || { echo "Wrong PUPMODE ($PUPMODE)!"; exit 1; }
@@ -81,7 +73,12 @@
 # WHITEOUTS
 # =============================================================================
 
-SFSPoints=$( grep -o -E "/initrd/pup_ro[0-9]+|/initrd/pup_[ayz]" /proc/mounts )   #110206 Dougal: get a list of the sfs mountpoints   SFR: increase amount of mountpoints (sfs_load can load >=10) and add pup_[ayz]
+for XFL in /sys/fs/aufs/si_*/br[0-9]* #get aufs branch list
+do
+ XFN="${XFL##*/}"
+ [ ${XFN:2} -lt 2 ] && continue
+ SFSPoints="${SFSPoints}`cat ${XFL} | cut -f1 -d'='` "
+done
 
 find . -mount \( -regex '.*/\.wh\.[^/]*' -type f \) | sed -e 's/\.\///;s/\.wh\.//' |
 while read -r N

I have also attached a patched version of the "snapmergepuppy" from tahrpup 6.0.2

gyro
snapmergepuppy.gz
Description  gunzip file to get executable script
gz

 Download 
Filename  snapmergepuppy.gz 
Filesize  4.16 KB 
Downloaded  33 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.0686s ][ Queries: 12 (0.0123s) ][ GZIP on ]