gaubert/gmvault — pull request #98 by jinnko (2013-01-08 15:32:37+00:00)
Title: Dereference symbolic links in startup script

Please merge these changes to support symbolic links to the startup script. This is tested on Debian squeeze and Mac OSX 10.8.2 and work well whether the script is a symlink or not, or any parent folder in the script path is a symlink.

This allows gmvault to be installed in another location (e.g. /opt/gmvault/bin/gmvault) and to only symlink the startup script to exist in a standard location (/usr/local/bin/gmvault > /opt/gmvault/bin/gmvault).

On linux "readlink -f" is entirely standard and will recursively dereference correctly.

On OSX the "-f" option doesn't exist, and the standard readlink won't recursively dereference and will not return a value when the file is not a symlink. Hence the choice to use perl as the shortest and most cross-platform solution available. I considered using the python equivalent but perl tends to be more ubiquitous and consistent.