Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Nov 2023 11:00:13 -0800 (PST)
From:      Roger Marquis <marquis@roble.com>
To:        pkgbase@freebsd.org
Subject:   Re: pkgsave cleanup
Message-ID:  <poo41o55-7p50-5869-688r-q4418703rpn8@mx.roble.com>
In-Reply-To: <7743601q-474s-p372-91p9-p52n9936263s@eboyr.pbz>
References:  <7743601q-474s-p372-91p9-p52n9936263s@eboyr.pbz>

next in thread | previous in thread | raw e-mail | index | archive | help
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
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?poo41o55-7p50-5869-688r-q4418703rpn8>