Re: pkgsave cleanup
- Reply: Matthew Seaman : "Re: pkgsave cleanup"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Nov 2023 19:00:13 UTC
For those who are concerned about backup files being left in non-backup
directories this small script will cleanup .pkgsave files:
DBPATH=/var/db/pkgsave/`date +%G%m%d%H%M`
if [ ! -d $DBPATH ]; then
mkdir -p $DBPATH
fi
for f in `find / -type f -name \*.pkgsave` ; do
fori="`echo $f | sed 's/.pkgsave//'`"
diff $f $fori >/dev/null 2>&1
if [ $? = 0 ]; then
rm -f $f
else
oripath="`dirname $f`"
if [ ! -d $DBPATH/$oripath ]; then
mkdir -p $DBPATH/$oripath
fi
mv -f $f $DBPATH/$oripath
fi
done
> Wondering if anyone has a patch (for a make flag) to prevent the
> creation of .pkgsave files in the same directory as the original? Would
> be ideal to create a tree under say /var/db/pkgsave for these (and a
> flag to prevent the rotation of system-critical files such as
> master.passwd).
>
> Other than a small pkgsave manual intervention we're up and running
> 14.0-RELEASE with a packaged base and no issues!
>
> Roger
>