I have created a deb package say abc.deb. Now there are few dependencies like python-dev, python-mysql etc., which are needed to be installed as a part of deb installation itself.
(i.e. when user runs dpkg -i abc.deb, the dependencies should also get installed automatically).
I am using a control file which contains few parameters like preinst, postinst etc. I tried to add Depends to the control file, but I guess, Depends only stops package installation if dependencies mentioned are not present. How could I install the dependencies as a part of deb package installation itself? I am looking for a solution that will work on Ubuntu 12.04.
P.S. When I try to install dependencies in my postinst script as
sudo apt-get install python-dev -y
I gives me an error:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?`
dpkg can only install single packages.
You should declare all your package's dependencies in the Depends field of the control file.
If your user then installs the package with dpkg -i package.deb, they will get a message that dependencies are missing. The user can then invoke apt-get -f install to fix missing dependencies from the package repository (this assumes that your dependencies actually are in the official repositories).
An alternative is to use a tool such as gdebi to install your package; gdebi knows how to fetch missing dependencies, making the apt-get -f install step unnecessary.
My advice is to ship your package.deb file (with proper dependency declaration) to your users, and advise them to install it with gdebi.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With