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 Wed 27 Aug 2014, 19:08
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Next Puppy Development » 5.x
Actually remove files from the pup_rw layer
Moderators: BarryK, Lobster
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: 419
Location: Brisbane, Australia

PostPosted: Tue 01 Dec 2009, 04:04    Post subject:  Actually remove files from the pup_rw layer
Subject description: without leaving .wh. files behind
 

Note: all this presuposses a frugal install, I don't know if it applies to a full install.

Problem:
1) A .pet includes a file in a .sfs, other than pup_ro2 (pup-nnn.sfs).
When the .pet is uninstalled, the file is simply removed, leaving a .wh. file behind which then hides the original file.
Not good.

2) A firefox-3.0.10.sfs is installed.
It gets automatically upgraded to firefox 3.0.15. This puts all the changed files in pup_rw.
The firefox-3.0.10.sfs is uninstalled and firefox-3.5.5.sfs is installed.
All the firefox-3.0.15 files in pup_rw are still there and now hiding the corresponding firefox-3.5.5 files.
Not good.

Solution:
The uninstall code, in both cases, actually removes files belonging to the package from pup_rw.

Proof of concept code:
Code:
#!/bin/bash

[ "$1" == "" ] && exit 1

XDIRS=""
for ONESPEC in `unsquashfs -l -d . $1`
do
   if [ "${ONESPEC%%/*}" == "." ]; then
      ONESPEC=${ONESPEC#*.}
      if [ "$ONESPEC" ]; then
         ZSPEC="/initrd/pup_rw$ONESPEC"
         if [ -d "$ZSPEC" ]; then
            XDIRS="$ZSPEC $XDIRS"
         else
            if [ -f "$ZSPEC" ]; then
               rm -rf "$ZSPEC"
            fi
         fi
         ZSPEC="/initrd/pup_ro1$ONESPEC"
         if [ -d "$ZSPEC" ]; then
            XDIRS="$ZSPEC $XDIRS"
         else
            if [ -f "$ZSPEC" ]; then
               rm -rf "$ZSPEC"
            fi
         fi
      fi
   fi
done

for ONESPEC in $XDIRS
do
   rmdir --ignore-fail-on-non-empty "$ONESPEC"
done

[ -d "/initrd/pup_rw/root" ] || mkdir "/initrd/pup_rw/root"
XLASTFN="/initrd/pup_rw/root/.wh.ZXzxYzxyZX"
touch "$XLASTFN"
rm -f "$XLASTFN"  #should force aufs layer "reval".

exit

This script accepts the name of an sfs file as parameter 1.
It actually removes any file in pup_rw that is "hiding" a file in the sfs, so that the original file is now revealed.
Tested by editing a text file that is in an installed sfs file. Thus creating a new version of the file in pup_rw.
Ran the scrip using the name of the sfs file as a parameter.
Result: There is no copy of the file in pup_rw. The file has reverted to the original.

Note: This works on my frugal install of pup-431.iso.

gyro
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 » Puppy Projects » Next Puppy Development » 5.x
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.0427s ][ Queries: 11 (0.0033s) ][ GZIP on ]