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 Sat 25 Oct 2014, 12:10
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 Posts_count_1  
Author Message
gyro

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

PostPosted: Tue 01 Dec 2009, 04:04    Post_subject:  Actually remove files from the pup_rw layer
Sub_title: 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:   Sort by:   
Page 1 of 1 Posts_count_1  
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:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0522s ][ Queries: 11 (0.0134s) ][ GZIP on ]