Skip to content
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

Install fails on Mac (no option -e for readlink) #38

Closed
gaffney opened this issue Dec 29, 2014 · 8 comments · Fixed by #40
Closed

Install fails on Mac (no option -e for readlink) #38

gaffney opened this issue Dec 29, 2014 · 8 comments · Fixed by #40
Labels

Comments

@gaffney
Copy link

gaffney commented Dec 29, 2014

There is no -e option on the readlink installed on Mac OSX, so the install fails completely (see L11 on install here)

bash-3.2$ sh /Users/me/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-tarruda-SLASH-zsh-autosuggestions.git/install
readlink: illegal option -- e
usage: readlink [-n] [file ...]
usage: dirname path

Setup completed successfully!

Refer to this commit: 32fb793

@gaffney
Copy link
Author

gaffney commented Jan 8, 2015

@faceleg I don't think this fixes it. Compare the Linux readlink -f to the Mac version:

Linux

-f, --canonicalize
    canonicalize by following every symlink in every component
    of the given name recursively; all but the last component must exist

Mac

-f format
    Display information using the specified format.  
    See the FORMATS section for a description of valid formats.

See also:

@faceleg
Copy link
Contributor

faceleg commented Jan 8, 2015

Thanks, reopening.

Seeing as you have quick access to a mac (I assume), would you mind fixing this?

@faceleg faceleg reopened this Jan 8, 2015
@gaffney
Copy link
Author

gaffney commented Jan 8, 2015

I thought about it for a bit and I could not think of a clean fix, as installing coreutils is not a viable option. (That is what I did to fix it locally).

Can possibly think about it / fix it later this week or next when I am not so busy.

@faceleg
Copy link
Contributor

faceleg commented Jan 8, 2015

We could use something like:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

From http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

@fregante
Copy link
Contributor

@faceleg's code seems to work for me (OSX 10.10)

@gaffney
Copy link
Author

gaffney commented Jan 23, 2015

@bfred-it Are you referring to what was committed or the script above?

@fregante
Copy link
Contributor

Script above my comment

@gaffney
Copy link
Author

gaffney commented Jan 23, 2015

Cool, can you make a PR with your install file?

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

Successfully merging a pull request may close this issue.

3 participants