K
K
kos212021-06-08 09:44:40
Debian
kos21, 2021-06-08 09:44:40

How to create a .deb package so that when updating a certain file is not overwritten?

I have a server. I need to package it in *.deb package. The file folder contains the .env file, which contains the configs for running this server (the user can change the configs after installation). How can I make sure that when updating using the same *.deb package, this .env file is not overwritten?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pfg21, 2021-06-08
@pfg21

write the path to this file in conffiles inside control.tar
i.e. you describe the file as a configuration file and its updates will be in a slightly different way.
read deb format description
https://www.debian.org/doc/manuals/maint-guide/dot...

I
Igor Makhov, 2021-06-08
@Igorgro

See how this is done in the redis-server package, it is about/etc/redis/redis.conf

N
Nadim Zakirov, 2021-06-08
@zkrvndm

You don't have to store configs in deb, but you really need to, you can put it like config.env.txt
When you start the server, check if the config exists and if it doesn't exist, automatically rename the text file.

C
CityCat4, 2021-06-08
@CityCat4

The package has an installation script that actually tells the package manager what to put where. It is necessary to provide in it a check for the existence of a file and copying a file with a different name, for example, in RPM such a file will be added with the addition of the name ".rpmnew"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question