# pkg upgrade and configuration files



## oOiOo (Sep 26, 2022)

Hello,

When creating a package, how to specify that a file should not be overwritten during an update (typically configuration files)?

 And more generally, how to list all the configuration files of a package? There is a "config_files" table in /var/db/pkg/local.sqlite, but it is empty on my different machines.

Regards


----------



## T-Daemon (Sep 26, 2022)

oOiOo said:


> When creating a package, how to specify that a file should not be overwritten during an update (typically configuration files)?


Are you asking a porting question? If that's the case please see Porters Handbook, 8.3. Configuration Files:



> If the port installs configuration files to PREFIX/etc (or elsewhere) do not list them in pkg-plist. That will cause pkg delete to remove files that have been carefully edited by the user, and a re-installation will wipe them out.
> 
> Instead, install sample files with a filename.sample extension. The @sample macro automates this, see @sample file [file] for what it does exactly. For each sample file, add a line to pkg-plist:
> 
> @sample etc/orbit.conf.sample


For the rest of the chapter please follow link.



oOiOo said:


> And more generally, how to list all the configuration files of a package? There is a "config_files" table in /var/db/pkg/local.sqlite, but it is empty on my different machines.


I don't know how to extract a list from the pkg(8) sqlite database, but from a ports tree that information can be listed from the ports pkg-plist, e.g.:


```
% grep sample /usr/ports/mail/spamassassin/pkg-plist
@sample %%ETCDIR%%/init.pre.sample
@sample %%ETCDIR%%/local.cf.sample
@sample %%ETCDIR%%/v310.pre.sample
@sample %%ETCDIR%%/v312.pre.sample
@sample %%ETCDIR%%/v320.pre.sample
@sample %%ETCDIR%%/v330.pre.sample
@sample %%ETCDIR%%/v340.pre.sample
@sample %%ETCDIR%%/v341.pre.sample
@sample %%ETCDIR%%/v342.pre.sample
@sample %%ETCDIR%%/v343.pre.sample
```


----------

