Skip to content

Commit

Permalink
Don't allow empty functions for before/after install
Browse files Browse the repository at this point in the history
If you invoke fpm with --before-upgrade, but not --before-install, then
the resultant before_install function becomes an empty function, which
bash/dash do not allow. (Syntax errors) This same problem applies to the
after flags. To avoid this, we'll insert a null statement if there's no
install script specified.

We don't need to do this for the (before|after)_upgrade functions, since
the time these templates are used is when --(before|after)-upgrade is
specified.
  • Loading branch information
Wesley Spikes committed Jan 22, 2015
1 parent 641a873 commit a9f7f26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/deb/postinst_upgrade.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ after_upgrade() {
after_install() {
<% if script?(:after_install) -%>
<%= script(:after_install) %>
<% else -%>
:
<% end -%>
}

Expand Down
2 changes: 2 additions & 0 deletions templates/deb/preinst_upgrade.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ before_upgrade() {
before_install() {
<% if script?(:before_install) -%>
<%= script(:before_install) %>
<% else -%>
:
<% end -%>
}

Expand Down

0 comments on commit a9f7f26

Please sign in to comment.