0

I would like to know if it is possible to have a debian package that installs another package as dependency which is not available from debian/ubuntu repositories.

So lets say I have a package A.deb which depends on B.deb but B.deb is not available in any repository. Both A.deb and B.deb are available only on local hard disk. Is there a way to install A.deb (for example with apt install ./A.deb) such that it will automatically also install B.deb?

0

Create a local tivial Repository. Place both A.deb and B.deb inside it. * Create a folder Repo. * Copy all .deb files inside it. * Now create Packages index file.

$ dpkg-scanpackages Repo > Repo/Packages
$ gzip -c Repo/Package > Repo/Packages.gz
  • Create entry for the Repo in sources.list.

    $ mkdir /etc/apt/sources.list.d
    
    $ touch /etc/apt/sources.list.d/Repo.list
    
    $ echo "deb [trusted=yes] file:/Repo /" > /etc/apt/sources.list.d/Repo.list
    

If this shows missing InRelease file or Release.gpg file use apt-get.

Now apt will search for missing dependencies in your Personal Repo also. And if A.deb depends on B.deb it will install it.

If you want to create a package to download and install various packages from different locations. May be you can use Debian preinst, postinst, prerm, and postrm scripts.

7.6 What is a Debian preinst, postinst, prerm, and postrm script?

These files are executable scripts which are automatically run before or after a package is installed or removed. Along with a file named control, all of these files are part of the "control" section of a Debian archive file.

https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html

2
  • Thank you for the answer, this is an interesting approach - I will take a closer look at it. Do you know if there is a way to install the B.deb independent from dependency management, during installation of A.deb? I am thinking of running a small script as post install step to install the B.deb package. – bender Nov 23 '18 at 10:09
  • The second part gives you an idea about that. e.g. If I wanted to install vivaldi and along with it also install widevine, I will just unpack the debian package make changes to it, repackage it & the install it. Vivaldi developers use this to add their key to apt and add entry to sources.list file. – harshit Nov 23 '18 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.