-
Notifications
You must be signed in to change notification settings - Fork 1
/
installer.sh
executable file
·47 lines (35 loc) · 1.13 KB
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# if true we will install latest instead of stable, see IB website
LATEST=false
# if true we will remove pre-existing IBJts in /opt
REPLACE_IF_EXISTS=true
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
exit 1
fi
which java || exit 1
which jar || exit 1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMPDIR=`mktemp -d`
pushd "$TMPDIR" > /dev/null
if $LATEST; then
echo "Downloading the latest testing version..."
wget --no-verbose -O unixmacosx.jar https://download2.interactivebrokers.com/download/unixmacosx_latest.jar
else
echo "Downloading the latest stable version..."
wget --no-verbose -O unixmacosx.jar https://download2.interactivebrokers.com/download/unixmacosx.jar
fi
echo "Extracting unixmacosx.jar..."
jar xf unixmacosx.jar
if $REPLACE_IF_EXISTS; then
echo "Removing previous version at /opt/IBJts..."
rm -rf "/opt/IBJts"
fi
echo "Installing to /opt/IBJts..."
mv IBJts /opt/
echo "Copying ib-tws wrapper to /usr/bin..."
cp "$DIR/ib-tws" /usr/bin/
echo "Installing the desktop file..."
desktop-file-install "$DIR/ib-tws.desktop"
popd > /dev/null
rm -r "$TMPDIR"