Reputation: 12348
Because we are not packaging something with an upstream tar/source/make, 99% of packaging documentation is not relevant. We need to deploy some scripts and java and war files to ubuntu. We are trying to do this via debian packages. We udnerstand it can automatically copy specific files you supply to the equivalent place in the target server, e.g. if we supply a file ./var/lib/tomcat7/webapps/someting.war, apt-get install ourapp will put the war in the right place. We also want to deploy libs and scripts.
All this will work, but how do we update it?
If we simply create a new package, presumably, the new files will overwrite the old files. But how do we clean up files which exist in the new package, but not in the old? Do we need to script this, or is there some automatically way to do this?
What about config files, deployed as part of the first package instlal? We dont want to overwrite these, but if they are not there, we need to put them there. Presumably we cant use the usual way of packaging files in this case.
Any ideas how we do this?
The other way is that we don't supply any files in the package as such, but do our own file management. We would supply say a single tar file in the package, then write install scripts which extract this into a temporary place, then copy the files onto the FS programatically. Is this a valid approach? in this case, there is not much point in using the .deb packaing system.
Upvotes: 0
Views: 496
Reputation: 189327
Uh, when replacing an old package, it is not usually a problem that the new package contains new files. It is when the new package no longer contains a particular file that you actually need to do something.
For a regular package, any files in the old version but not in the new version are removed by dpkg
when you upgrade; so you don't explicitly need to do anything yourself. See https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-unpackphase
As for configuration files, marking something as a conffile will behave exactly like you describe. When your upstream default conffile changes, you will usually want to upgrade the user's conffile to the latest default, too. Using ucf
in your package will handle this scenario nicely.
I hope I understand your question correctly. I originally (mis-?)read it as you want to manage everything in your package installation scripts; this is e.g. how the Adobe Flash installer package works (they cannot include the actual payload in the package, so the "packaging" script downloads it and extracts its contents into the right places), but it has a host of problems, and would not be an approach I recommend.
Upvotes: 1