more efficient pet removal

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

more efficient pet removal

#1 Post by mavrothal »

When PPM removes a pet that had overwritten original files of the puppy.sfs, copies the originals to the current savelayer. As a result the savefile gets filled up with duplicate files.
Presumably this is because whiteout files may have escaped removal and break the application/system.

The attached pet of removepreview.sh does not copy-up the originals after removal and instead removes the whiteouts more effectively.
Has been tested (briefly) in pupmodes 2, 5, 6, 7, 12 and 13 and works as expected. Additional testing is more than welcome.

It has NOT been tested with a multisession CD/DVD, so if anyone could try it there and report would be nice. Just install a newer version of an app already installed, remove it and check that the original (and everything else) still works as expected.

The attached pet has the following changes

Code: Select all

--- a/usr/local/petget/removepreview.sh
+++ b/usr/local/petget/removepreview.sh
@@ -72,20 +72,16 @@
     else
      S=$(ls /initrd/pup_ro{?,??}"$ONESPEC" 2>/dev/null| grep -v '^/initrd/pup_ro1/'| head -n 1)
     fi # pup_ro2 - pup_ro99
+    rm -f "$ONESPEC"
+    # In PUPMODE 3|7|13 the file will remain till merging. 
+    # Better remove now in case we do not shutdown properly.
+    rm -f "/initrd${SAVE_LAYER}${ONESPEC}" 2>/dev/null
+    # Now delete the whiteouts that will hide the original
     if [ "$S" ]; then
-     #the problem is, deleting the file on the top layer places a ".wh" whiteout file,
-     #that hides the original file. what we want is to remove the installed file, and
-     #restore the original pristine file...
-     cp -a --remove-destination "$S" "$ONESPEC" #120103 shinobar.
-     #120103 apparently for odd# PUPMODEs, save layer may have a lurking old file and/or whiteout...
-     if [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ];then
-      [ -f "/initrd${SAVE_LAYER}${ONESPEC}" ] && rm -f "/initrd${SAVE_LAYER}${ONESPEC}" #normally /pup_ro1
-      BN="`basename "$ONESPEC"`"
-      DN="`dirname "$ONESPEC"`"
-      [ -f "/initrd${SAVE_LAYER}${DN}/.wh.${BN}" ] && rm -f "/initrd${SAVE_LAYER}${DN}/.wh.${BN}"
-     fi
-    else
-     rm -f "$ONESPEC"
+     BN="`basename "$ONESPEC"`"
+     DN="`dirname "$ONESPEC"`"
+     rm -f "/initrd/pup_rw/${DN}/.wh.${BN}" 2>/dev/null
+     rm -f "/initrd${SAVE_LAYER}${DN}/.wh.${BN}" 2>/dev/null
     fi
    fi
   done
@@ -96,6 +92,7 @@
  do
   if [ -d "$ONESPEC" ];then
    [ "`ls -1 "$ONESPEC"`" = "" ] && rmdir "$ONESPEC" 2>/dev/null #120107
+   rmdir "/initrd${SAVE_LAYER}${ONESPEC}" 2>/dev/null
   fi
  done
  ###+++2011-12-27 KRG
Should work with most puppies but if you have an older one (Precise, Slacko-5.x) you will also need libsturdust
Attachments
removepreview_test-1.pet
(5.79 KiB) Downloaded 183 times
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Argh, I'll test it if you'll tell me the latest version of Puppy that can still do multisession. I've been using Quirky Werewolf 64 for a while, but it only remasters. Barry doesn't like multisession for some reason.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#3 Post by mavrothal »

Flash wrote:Argh, I'll test it if you'll tell me the latest version of Puppy that can still do multisession. I've been using Quirky Werewolf 64 for a while, but it only remasters. Barry doesn't like multisession for some reason.
Thank you.
My understanding is that both "official" puppies (Tahr-6.0.5 and Slacko-6.3.2) are OK with multisession CD/DVD. However any older puppy that you may have around should also work as long as you also install the aforementioned libstardust pet.

BTW, I believe that multisession is now fixed in the new puppy init and the next woof-CE puppy that comes out (LxPupSc?) should be OK again
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#4 Post by gyro »

mavrothal wrote:BTW, I believe that multisession is now fixed in the new puppy init and the next woof-CE puppy that comes out (LxPupSc?) should be OK again
Unfortunately there was one more thing to fix, a 1 line change to the "copy_folders" whiteout file processing code in "init".
It's fixed in woof-ce 'rationalise' but I suspect that LxPupSc-17.01.22 just missed it.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#5 Post by mavrothal »

gyro wrote: It's fixed in woof-ce 'rationalise' but I suspect that LxPupSc-17.01.22 just missed it.
It did.
Actually is from the Jan 6 git so more mode-77 changes are missing.
Next one then.

BTW rationalised was deemed stable enough and merged back into testing. So you might want to commit into testing instead.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

Post Reply