Skip to content

Mix.Release script requires absolute execution path #13672

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xorrvin opened this issue Jun 17, 2024 · 1 comment
Closed

Mix.Release script requires absolute execution path #13672

xorrvin opened this issue Jun 17, 2024 · 1 comment
Labels

Comments

@xorrvin
Copy link

xorrvin commented Jun 17, 2024

Elixir and Erlang/OTP versions

Elixir 16.2
OTP 26.2.5

Operating system

NetBSD

Current behavior

After producing a release with mix release, resulting main script for a release expects absolute directory path for the invocation.

SELF=$(readlink "$0" || true)
if [ -z "$SELF" ]; then SELF="$0"; fi
RELEASE_ROOT="$(CDPATH='' cd "$(dirname "$SELF")/.." && pwd -P)"

It works if you're executing script directly, or if you're making an absolute symlink; in both cases $SELF is an absolute path.
However if one would create a symlink like that:

ln -s ../lib/whatever/bin/test_release bin/test_release

Script execution will fail:

$ test_release
cd: can't cd to ../lib/whatever/bin/..

Usecase:

Trying to make a binary package out of release folder requires either custom prefix (e.g. release folder is copied to /opt/whatever and then PATH is updated) or creating an absolute symlink to /usr/bin or other prefix which is used on a target system.

Relative symlink would allow much easier deployment of Mix.Releases, because it will eliminate post-install step which may not be available for a particular distribution method/system.

Thank you!

Expected behavior

Script works

@josevalim
Copy link
Member

A pull request to tackle this is welcome. We may not have time to prioritize this. :)

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

No branches or pull requests

2 participants