Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Fix the printing of the installed nginx version
Browse files Browse the repository at this point in the history
Previously the nginx version command was failing since the
`nginx-$STACK` binary does not exist, resulting in output like:

```
remote: -----> Installed directory to /app/bin
```

This failure went unnoticed since `pipefail` mode is not enabled.

The nginx binary path has been fixed, and the command now uses
`-v` instead of `-V` since the former only output one line, avoiding
the need to `head -n1`. In addition, the `cut` usage shows more of
the original line in the case of no match.

Fixes #174.
  • Loading branch information
edmorley committed Nov 7, 2020
1 parent ea0de3e commit b593a21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Fix the printing of the installed nginx version
* [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Switch to the recommended S3 URL format
* [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Remove unused archive caching
* [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Fail the build early on unsupported stacks
Expand Down
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ esac

mkdir -p $build_dir/bin
curl -sSf "${nginx_archive_url}" | tar -xzC "${build_dir}/bin"
nginx_version=$($build_dir/bin/nginx-$STACK -V 2>&1 | head -1 | awk '{ print $NF }')
nginx_version=$("${build_dir}/bin/nginx" -v |& cut -d '/' -f 2-)
cp -a $bp_dir/scripts/{boot,config} -t $build_dir/bin/
echo "-----> Installed ${nginx_version} to /app/bin"
echo "-----> Installed nginx ${nginx_version} to /app/bin"

mkdir -p $build_dir/config
cp $bp_dir/scripts/config/templates/mime.types $build_dir/config
Expand Down

0 comments on commit b593a21

Please sign in to comment.