A package being installed with apt-get has a dependency on java that I want to ignore.
$ apt-cache depends some-package
some-package
PreDepends: <java7-runtime-headless>
default-jre-headless
openjdk-7-jre-headless
PreDepends: unzip
...
$ sudo apt-get install some-package -o Dpkg::Options::='--ignore-depends=default-jre-headless,openjdk-7-jre-headless,java7-runtime-headless'
The following extra packages will be installed:
ca-certificates-java fontconfig-config fonts-dejavu-core java-common
libasyncns0 libcups2 libflac8 libfontconfig1 libjpeg-turbo8 libjpeg8
liblcms2-2 libnspr4 libnss3 libnss3-nssdb libogg0 libpulse0 libsctp1
libsndfile1 libvorbis0a libvorbisenc2 lksctp-tools openjdk-7-jre-headless
tzdata-java
I went with a shotgun approach on the ignore-depends
parameter to try cover various packages, but openjdk-7-jre-headless
seems to always be pulled in. Have also tried adding in the PreDepends to exclude.
How can I prevent openjdk from being installed?
edit seems like the installation is being triggered by the predepends
:
From What is the difference between dependencies and pre-depends?
Pre-Depends
This field is like Depends, except that it also forces dpkg to
complete installation of the packages named before even starting the
installation of the package which declares the pre-dependency
https://serverfault.com/questions/250224/how-do-i-get-apt-get-to-ignore-some-dependencies discusses a way around this:
You can change the dependencies of a deb package like this:
- Unpack deb:
ar x golden-linux.deb
(will create i.e. three files: debian-binary control.tar.gz data.tar.gz) - Unpack control archive:
tar xzf control.tar.gz
(will create: postinst postrm preinst prerm md5sums control) - Fix dependencies in control (use a text editor)
- Repack control.tar.gz:
tar c {post,pre}{inst,rm} md5sums control | gzip -c > control.tar.gz
- Repack deb:
ar rcs newpackage.deb debian-binary control.tar.gz data.tar.gz
So I am assuming this is something I would need to do to get this to work...
predepends
- read up a bit on this, and found another solution somewhere that discussed fetching the dpkg, extracting it, rewritting one of the metadata files and repacking it before installing.