gyro
Joined: 28 Oct 2008 Posts: 289 Location: Brisbane, Australia
Posted: 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
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.
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