# How to prevent pkgsave files



## oOiOo (Nov 16, 2020)

Hi all,
On a nanobsd machine, I need to install somes ports. Before that, I update the current pkg version

```
cust_local_packages()
{
        if [ -z $LOCAL_PACKAGES ] ; then
                return 0
        fi
        pkg upgrade -y pkg
        strip /usr/local/sbin/pkg
        strip /usr/local/sbin/pkg-static
        ...
}
```
This upgrade  make a backup of `pkg-static` as `pkg-static.pkgsave`. This file is about 20Mo (approx. 15% of the root filesystem). I could just remove it, but is there a best method to prevent this.
Thanks in advance


----------



## oOiOo (Nov 16, 2020)

I reply to myself : it's hard-coded in libpkg/pkgadd.c, line 752
As I understand, since it's not a local installation, a backup is made. I'll remove it manually.


----------



## Phishfry (Nov 17, 2020)

I use this function in my config file:

customize_cmd cust_pkgng
NANO_PACKAGE_LIST="*"

With this it will install all packages I place in /usr/src/tools/tools/nanobsd/pkg/
It does require pkg.txz to be included in this directory.


----------



## oOiOo (Nov 17, 2020)

Phishfry said:


> With this it will install all packages I place in /usr/src/tools/tools/nanobsd/pkg
> It does require pkg.txz to be included in this directory.


Thanks for your reply. In my case, I build some local packages from a local tree ports (in addition to official ports). 
And sometimes, I don't know why, upgrading pkg is require. I'll dig this.


----------

