how to upgrade my Debian package with minor changes

I created a .deb which installs some features and copies some library to /usr/lib/ location. Now that if I have changed one of the .so file in the package and want to update the same to Debian package, what could be the scenario.

Simply how can i update files after installing the package. In windows the same is achieved by .MSP files to corresponding .MSI . How can I do the same in ubuntu?

Any help is appreciated.Thanks in advance.


Solution 1:

First cd to the directory where your deb file is:

cd ~/lab

Then extract your deb file there:

dpkg-deb --raw-extract my.deb .

It will create some directories like:

DEBIAN  etc  usr

Apply your minor update whatever it's a new file removal or etc to the specific files you want.

Then recreate the package simply with:

dpkg-deb -b new.deb

Solution 2:

Yes, you can repackage with updates to the files your package supplied, however, you need to change the version manually.

I'd use dpkg-repack. It is a wonderful tool to repack installed debian package.

You can use this command to generate the build directory of all files for this package under the current directory using this command

sudo dpkg-repack --generate your-package-name-here

Now, after it gathers the files of the package in a folder name with format your-package-name-some-random-number, you can then change the package version in the geneated control file there.

You're you're done, use dpkg-deb to rebuild

dpkg-deb --build generate-folder-for-package

If you don't mind have the package same version, just do plain dpkg-repack

sudo dpkg-repack <your-package-name>