deb package creation using fpm with build dependencies

4.3k views Asked by At

I'm trying to create a deb package using fpm, which contains some shell script files.But the deb package should create with a dependency called vim(vim editor in Linux). Means when installing deb package it should install vim first and then script files.

Requirement is when installing deb package the vim should install first and then script files.

The fpm command I have tried is :

  fpm -s dir -t deb -n 'test' --deb-pre-depends vim --after-install /home/test/testfile.sh -C /home test

And after deb package created. when installing it, I'm getting following errors:

dpkg: regarding test_1.0_amd64.deb containing test, pre-dependency problem:
 test pre-depends on vim
  vim is not installed.

dpkg: error processing archive test_1.0_amd64.deb (--install):
 pre-dependency problem - not installing test
Errors were encountered while processing:
 test_1.0_amd64.deb 

Thanks in Advance...

2

There are 2 answers

0
Vorsprung On

try --depends instead of --deb-pre-depends

"Depend" and "Pre Depend" are subtly different see here https://www.debian.org/doc/debian-policy/ch-relationships.html

Sounds like what you want to do is probably "Depend" so keep it simple

0
TomDotTom On

As @Vorsprung as alredy mentioned you need to use --depends:

fpm -s dir \
    -t deb \
    -n 'test' \
    --depends vim \
    --after-install /home/test/testfile.sh \
    -C /home test

You need to be aware that dpkg won't install the dependencies for you, but you can run apt-get afterwards to install all the missing dependencies:

dpkg -i test.deb
apt-get install -f