Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Package the _contents_ of Debian maintainer scripts. #247

wants to merge 1 commit into


None yet
2 participants

mblair commented Aug 9, 2012

I came across this while using the internal FPM API.

If I specified an after_install script (as an example), the Debian postinst script included in the package was actually just a pointer to the file I originally specified. Unfortunately, that file didn't exist on the target system, so my postinst steps were failing!

This PR writes the contents of the maintainer scripts you specify.

@jordansissel jordansissel commented on the diff Aug 9, 2012

@@ -398,7 +398,7 @@ def write_scripts
with(control_path(filename)) do |controlscript|
@logger.debug("Writing control script", :source => filename, :target => controlscript)
- File.write(controlscript, script(scriptname))

jordansissel Aug 9, 2012


The right way (for now) to set scripts is to use the instance variables, see :


For now, I think the intention is that 'script(scriptname)' always return the contents of a script, not the path to a script. So from your end, you are responsible (at least right now) for reading the file.

package.scripts[:after_install] = File.read("/path/to/script")

Makes sense?

I'm super interested in making this easier with respect to API - how can I help there? Open to input :)


mblair commented Aug 9, 2012

Hold the phone, need to test this further.


mblair commented Aug 9, 2012

Aha, didn't catch that. I think it's entirely reasonable to require that internal users send file contents instead of paths using the instance variables, so consider this PR useless.

I think a useful step would simply be internal API documentation- I've been using it heavily and learning idioms as I go (like setting :deb_ignore_iteration_in_dependencies? before calling convert(FPM::Package::Deb), for example), so I'm totally willing to help out here :-)


jordansissel commented May 27, 2013

The internals now have the 'before_install' and similar settings take script contents instead of file paths now.

package.scripts[:before_install] = "#!/bin/sh\necho hello world\n"

Closing this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment