LSTS / neptus

Neptus, Command and Control Infrastructure
http://www.lsts.pt/toolchain/neptus/
Other
80 stars 69 forks source link

neptus.sh no longer work on MacOS X #91

Closed fredpy closed 6 years ago

fredpy commented 6 years ago

the form if [ ${JAVA_MACHINE_TYPE} == 'linux-x64' ]; then

is no longer accepted on MacOS bash (single bracket syntax present some potentially parsing issues in shell scripts and therefore has been disabled on MacOS).

Now MacOS only accepts the following (which is supported by any bash)

if [[ ${JAVA_MACHINE_TYPE} == 'linux-x64' ]]; then

similarly it looks like MacOS does not accept the option -f on readlink. Therefore it would be better to use what you had previously (basically no attempt to follow the link) at least for Mac

paulosousadias commented 6 years ago

Thanks Frederic. Can you try commits 2fd1aa5b6 and b5625c82f?

fredpy commented 6 years ago

Thanks for the quick update

https://github.com/LSTS/neptus/commit/2fd1aa5b6250b7ff6715e15a499de6af6e4b7089 address the first issue (I already did such change locally)

https://github.com/LSTS/neptus/commit/b5625c82fd10803fb8ca070eceee296f8d1ce066 did not work as the readlink command exists but is just not supporting the -f option.

But your detection of MacOS is working (as showed in the output snippet below) so you can use it instead.

sintefpc7113:neptus fredericpy$ ./neptus.sh 
readlink: illegal option -- f
usage: readlink [-n] [file ...]
usage: dirname path
MacOS found!

so based on this a code like the following should work (although I am rusty on the "case" commands in shell):

unameOut="$(uname -s)"
case "${unameOut}" in
    Darwin*)   NEPTUS_HOME=`dirname $PROGNAME`;;
    *)          NEPTUS_HOME=`dirname $(readlink -f $PROGNAME)`
esac
paulosousadias commented 6 years ago

Retried as suggested in 1a986b10d.

paulosousadias commented 6 years ago

Did the fix resolved the issue?