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.15k stars 1.07k forks source link

How do I create debian package with config files? #1306

Open sc0rp10 opened 7 years ago

sc0rp10 commented 7 years ago

I need to create simple deb package from my directory with single package file and one config file. I want to place file foo.py to /opt/foo/foo.py and place foo.conf to /etc/supervisor/conf.d/foo.conf it's simple and clear case.

# tree
.
├── etc
│   └── supervisor
│       └── conf.d
│           └── foo.conf
└── foo.py

But when i ran command

# fpm \
    --prefix /opt/foo
    --exclude "Makefile" \
    --exclude "conf" \
    --config-files etc/supervisor/conf.d/foo.conf \
    -s dir \
    -t deb \
    -n foo \
    -a noarch .

I've got an error:

Invalid package configuration: Error trying to use 'etc/supervisor/conf.d/foo.conf' as a config file in the package. Does it exist? {:level=>:error}

How can I avoid this issue?

jhermann commented 7 years ago

Don't set a prefix.

sc0rp10 commented 7 years ago

@jhermann but how can I set installation path without prefix?

jhermann commented 7 years ago

reflect the installation tree in your source repo. for convenience, you could symlink the major file(s) on top-level.

the better way is to have a package.sh or Makefile, which prepares the desired tree in a staging directory (cp -rpl …), and then calls fpm on that.

BTW, anything in /etc is automatically marked as conffile.

jordansissel commented 7 years ago

Lots of folks stumble on this feature over the years, and I'm thinking that this is because the way this flag works is pretty confusing.

sc0rp10 commented 7 years ago

@jordansissel is there any chance for work these flags together with --prefix? I think it will be nice addition to your great tool