I have created a .deb package using equivs-build command and providing necessary control, preinst, postinst, etc. I noticed that version can also be mentioned in control file. Now I want to create a .deb package with updated source code and I want to enable user to upgrade the package if it is already installed (and is of previous version, of course), as I won't be changing conf related files, etc. One way I can think of is to write a script which will first check for installed version, and will take actions accordingly (i.e. if installed, just update the source-code, database-migrations, etc. and if not, install the package using dpkg -i <package-name>). I was wondering if there was a way to achieve using dpkg only (something like dpkg upgrade <package-name>) which will handle installation or up-gradation as required.
Asked
Active
Viewed 1,406 times
1
exAres
- 263
1 Answers
1
The command you are looking for is indeed dpkg -i. This will install if not installed and upgrade if already installed. dpkg doesn't change user-modified configuration files. It will ask you what to do about such cases (keep the modifications, discard the modifications, etc.) and it will always keep a backup of whatever you discard (the new config file provided by the package, or the old user-modified file ). Any file installed by the package in /etc/ is considered by dpkg as a configuration file.
muru
- 207,228