Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a custom install directory when making a deb package with fpm

I'm using fpm to create a deb package, but when I install that deb package, it is installed into the wrong location, my fpm command is:

fpm -f -s "dir" -t "deb" -a "all" -n "my_project" -v 1 -C "/tmp/tmpjWTuVp" /tmp/tmpjWTuVp/my_project

The folder i want to package up exists at /tmp/tmpjWTuVp/my_project, but every time i install it with:

dpkg -i my_package.deb

it installs it into /tmp/tmpjWTuVp/my_project, ideally i'd like it to install into /var/lib/my_project. I have tried --installdir and --root with my dpkg command, but it complains with cannot access archive: No such file or directory

Other information:

  • I'm installing onto an ubuntu box
  • I'm very new to deb packaging, so may have missed something obvious
  • I'm not bound to fpm and happy to hear other viable suggestions
  • inside my_project is a python virtualenv and my django project
like image 291
farridav Avatar asked Oct 20 '22 04:10

farridav


1 Answers

I have randomly found the answer to this immediately after writing this question...

basically the last, unnamed argument within the fpm command can contain an equals separator which defines the directory to come from, and to install to, so the command I ended up using was:

fpm -f -s "dir" -t "deb" -a "all" -n "my_project" -v 1 -C "/tmp/tmpjWTuVp" my_project=/var/lib/my_project

Notice the my_project=/var/lib/my_project, the left side is the directory name of my project (relative, because I used -C to change directory to /tmp/tmpjWTuVp before looking for packages) and on the right side is where I want to install to on the remote machine...

like image 73
farridav Avatar answered Oct 21 '22 23:10

farridav