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: Select all
#!/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
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