Skip to content

Script Templates

jordansissel edited this page Aug 7, 2012 · 2 revisions

Script Templates

As of fpm 0.4.11, package/maintainer scripts can be templated. To activate this feature, you must use the --template-scripts flag.

Example:

% cat /tmp/x
#!/bin/sh
echo "HURRAY FOR <%= name %> version <%= version %>"
% ruby bin/fpm -s dir -t rpm -n fizz --prefix /opt --template-scripts --before-install /tmp/x --after-remove /tmp/x /etc/motd 
...
% sudo rpm -i fizz-1.0-1.x86_64.rpm
HURRAY FOR fizz version 1.0
% sudo rpm -e fizz                 
HURRAY FOR fizz version 1.0

Variables

For gritty details, the 'scope' of the template is the package itself, so any methods there are valid.

For a brief overview, these are available:

  • name
  • version
  • iteration
You can’t perform that action at this time.