File: common.sh

package info (click to toggle)
darktable 1.0.4-1%2Bdeb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 11,620 kB
  • sloc: ansic: 98,133; cpp: 26,859; xml: 2,202; lisp: 1,940; sh: 720; python: 274; awk: 89; makefile: 83; perl: 57; asm: 46
file content (19 lines) | stat: -rwxr-xr-x 945 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# Partly stolen from http://imagejdocu.tudor.lu/doku.php?id=diverse:commandline:imagej
# Detect readlink or realpath version
# if GNU readlink is known to be installed, this code can be replaced by "alias ReadLink='readlink -f'"
alias ReadLink='readlink' # Default
OS=$(uname)
if [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && which greadlink >/dev/null 2>&1 ; then
        # Using GNU readlink on MacOS X or FreeBSD
        alias ReadLink='greadlink -f'
elif [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" -o "$OS" = "Linux" ] && which realpath >/dev/null 2>&1 ; then
        # Using realpath on MacOS X or FreeBSD
        alias ReadLink='realpath'
elif [ -f "$(which readlink)" ] && readlink --version | grep coreutils >/dev/null 2>&1 ; then
        alias ReadLink='readlink -f'  # use GNU readlink
else
        alias ReadLink='echo'
        echo "Please install realpath or GNU readlink. Symbolic links may not be resolved properly" >&2
fi