Answer the question
In order to leave comments, you need to log in
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
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...
See how this is done in the redis-server package, it is about/etc/redis/redis.conf
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.
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 questionAsk a Question
731 491 924 answers to any question