summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Alex2021-07-31 13:36:52 +1000
committerBen Alex2021-07-31 14:22:11 +1000
commitce188cecc1ade27a4dcdc138e08884e49a475f22 (patch)
tree69df7fa6673d0997b9cd8a4799beca57ce6b52e2
parent0f9f96ccb314cbe4d37a8f2f80635a3e17c43582 (diff)
downloadaur-ce188cecc1ade27a4dcdc138e08884e49a475f22.tar.gz
Refactor to support differing JRE locations
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD45
2 files changed, 35 insertions, 12 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b4397685e36..bc6f1a2dd70 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = ib-tws
pkgdesc = Electronic trading platform from discount brokerage firm Interactive Brokers
pkgver = 985.1h
- pkgrel = 1
+ pkgrel = 2
url = http://interactivebrokers.com/
arch = any
license = custom
diff --git a/PKGBUILD b/PKGBUILD
index 9ec4b51ee7b..19581dcb8bc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=ib-tws
pkgver=985.1h
-pkgrel=1
+pkgrel=2
pkgdesc='Electronic trading platform from discount brokerage firm Interactive Brokers'
arch=('any')
url="http://interactivebrokers.com/"
@@ -32,20 +32,43 @@ sha256sums=('4b65b33dc88d77fef6e7ba1bdc1ae88b149296d3e1eb87db251bfcdf119a1f22'
build() {
cd ${srcdir}
+ rm -rf ${srcdir}/target ${srcdir}/jre
+ mkdir ${srcdir}/target ${srcdir}/jre
+
chmod +x tws-${pkgver}-standalone-linux-x64.sh
- # Assumes no other Install4J packages are in use by user; if so, makepkg from dedicated user account
- majorVer=$(echo "$pkgver" | sed "s/\([0-9]\+\)\..*/\1/")
- rm -rf $HOME/.install4j $HOME/.i4j_jres $HOME/tws $HOME/Desktop/Trader\ Workstation*.desktop $HOME/.local/share/applications/Trader\ Workstation*.desktop
- ./tws-${pkgver}-standalone-linux-x64.sh -q
+ ./tws-${pkgver}-standalone-linux-x64.sh -q -dir ${srcdir}/target
- BUNDLED_JRE_VER=$(ls -1 ${HOME}/.i4j_jres)
- mv ${HOME}/.i4j_jres/${BUNDLED_JRE_VER} ${HOME}/.i4j_jres/jre
- mv ${HOME}/.i4j_jres/jre ${srcdir}/jre
- mv ${HOME}/tws/jars/*.jar ${srcdir}
- rm -rf $HOME/.install4j $HOME/.i4j_jres $HOME/tws $HOME/Desktop/Trader\ Workstation*.desktop $HOME/.local/share/applications/Trader\ Workstation*.desktop $HOME/.local/share/applications/install4j_*.desktop
- cd ${srcdir}
+ # install4j provides a "shared" JRE that may go into /opt, /usr/local or $HOME/.i4j_jres/.
+ # If it already exists, the install4j log will include a "java.home=" truncated path.
+ BUNDLED_JRE_LOCATION=$(grep java.home ${srcdir}/target/.install4j/installation.log | head -n 1 | cut -d '=' -f 2 | sed 's/\.\.\.//g')
+ if [ -z "${BUNDLED_JRE_LOCATION}" ]; then
+ echo "java.home JRE location could not be found in the log"
+ exit 1
+ fi
+ BUNDLED_JRE_LOCATION=$(echo ${BUNDLED_JRE_LOCATION}*)
+ echo "java.home JRE location expanded to ${BUNDLED_JRE_LOCATION}"
+
+ if [ ! -f ${BUNDLED_JRE_LOCATION}/bin/java ]; then
+ echo "java.home JRE location did not contain java; finding log entry which installed java"
+ BUNDLED_JRE_LOCATION=$(grep -e "Install file.*\/java\;" ${srcdir}/target/.install4j/installation.log | head -n 1 | cut -d ';' -f 1|sed -e 's/ .*Install file\: //g'|sed 's/\/bin\/java//')
+ if [ -z "${BUNDLED_JRE_LOCATION}" ]; then
+ echo "Could not find bundled JRE installation entry in log"
+ exit 1
+ fi
+ fi
+ if [ -f ${BUNDLED_JRE_LOCATION}/bin/java ]; then
+ echo "Confirmed java in ${BUNDLED_JRE_LOCATION}"
+ else
+ echo "Cannot find java; last tried ${BUNDLED_JRE_LOCATION}"
+ exit 1
+ fi
+
+ # copy the bundled JRE (do not move it as other install4j applications may be sharing it)
+ cp -r ${BUNDLED_JRE_LOCATION}/* ${srcdir}/jre
+ mv ${srcdir}/target/jars/*.jar ${srcdir}
# Thanks to http://finance.groups.yahoo.com/group/TWSAPI/files/RPM%20spec%20file/
+ majorVer=$(echo "$pkgver" | sed "s/\([0-9]\+\)\..*/\1/")
unzip -o jts4launch-${majorVer}.jar trader/common/images/ibapp_icon_48x48.gif
unzip -o jts4launch-${majorVer}.jar trader/common/images/quote_details_48x48.jpg
convert trader/common/images/ibapp_icon_48x48.gif ${pkgname}.png