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