aboutsummaryrefslogtreecommitdiff
path: root/setup/unix/setup.sh
blob: 478966ea0c2e45298415e5cb5dd19f6adbed5b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

UNIX_PATH="/opt/traccar"

if which java &>/dev/null
then
  if [ $(java -version 2>&1 | grep -i version | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -lt 17 ]
  then
    echo "Java 7 or higher required"
  else
    mkdir -p $UNIX_PATH
    cp -rf * $UNIX_PATH
    chmod -R go+rX $UNIX_PATH
    $UNIX_PATH/bin/traccar install
    rm $UNIX_PATH/setup.sh
  fi
else
  echo "Java runtime is required"
fi