jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.08k stars 1.07k forks source link

Buildroot when building .deb? #2049

Open mfgordon opened 4 months ago

mfgordon commented 4 months ago

Does fpm have the concept of a buildroot? For example, I have a .tar containing a number of files that I want to build as a Debian package. Rather than installing those files into /usr/bin, /usr/lib etc. I'd like to unpack the tree into a temporary directory and have fpm pretend that my temporary directory is the root when accessing files to add to the package

jordansissel commented 4 months ago

Yes indeed! If you have a directory with files you want to install as a buildroot-style layout, you can use the -C flag. For example, if you have a file layout like this:

You can create a package for this, treating ./foo/ as the root directory:

fpm -s dir -t deb -n example -C ./foo .

if you don’t have a buildroot-layout you can still pick paths to install in the specific locations in the target package. There is some documentation about this to use the localPath=destinationPath syntax.

example, if you have two files:

fpm -s dir -t deb -n example ./example=/usr/bin/example ./example.conf=/etc/example.conf
jordansissel commented 4 months ago

(I typed the above on my phone so u may have made errors. Do let me know if you need more info or if something doesn’t work)

mfgordon commented 3 months ago

Thanks; that seems to work for my simple test. I'd spotted the -C option, which sounded like what I wanted, but I couldn't get it to work. I think the bit I was missing was the need to specify the filename as, for example, ./usr/bin/vmview rather than /usr/bin/vmview when using -C ./buildroot