From ca84886ebbf42e3eb0f808bf9d51110451895401 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 12 Mar 2020 22:46:24 +0100 Subject: [PATCH] make virtualenv for mlat-client --- scripts/adsbexchange-mlat.service | 2 +- setup.sh | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/adsbexchange-mlat.service b/scripts/adsbexchange-mlat.service index b249560..19130d6 100644 --- a/scripts/adsbexchange-mlat.service +++ b/scripts/adsbexchange-mlat.service @@ -6,7 +6,7 @@ After=network.target [Service] EnvironmentFile=/etc/default/adsbexchange -ExecStart=/usr/bin/mlat-client \ +ExecStart=/usr/local/share/adsb-exchange/venv/bin/python3 /usr/local/share/adsb-exchange/venv/bin/mlat-client \ --input-type $INPUT_TYPE --no-udp \ --input-connect $INPUT \ --server $MLATSERVER \ diff --git a/setup.sh b/setup.sh index 4404b41..e4f81dc 100755 --- a/setup.sh +++ b/setup.sh @@ -140,7 +140,7 @@ fi # Check that the prerequisite packages needed to build and install mlat-client are installed. - required_packages="build-essential debhelper python python3-dev socat ntp" + required_packages="build-essential debhelper python python3-dev socat ntp python3-pip python3-virtualenv" progress=4 for package in $required_packages @@ -163,7 +163,8 @@ fi # Check if the mlat-client git repository already exists. INSTALL_DIR=/usr/local/share/adsb-exchange MLAT_DIR=$INSTALL_DIR/mlat-client - mkdir -p $INSTALL_DIR + VENV=$INSTALL_DIR/venv + mkdir -p $INSTALL_DIR >> $LOGFILE 2>&1 if [ -d $MLAT_DIR ] && [ -d $MLAT_DIR/.git ]; then # If the mlat-client repository exists update the source code contained within it. cd $MLAT_DIR >> $LOGFILE @@ -181,12 +182,17 @@ fi sleep 0.25 # Build and install the mlat-client package. - dpkg-buildpackage -b -uc >> $LOGFILE 2>&1 + # dpkg-buildpackage -b -uc >> $LOGFILE 2>&1 + virtualenv -p /usr/bin/python3 $VENV >> $LOGFILE 2>&1 + source $VENV/bin/activate >> $LOGFILE 2>&1 + python3 setup.py build >> $LOGFILE 2>&1 + python3 setup.py install >> $LOGFILE 2>&1 + echo 44 - cd .. >> $LOGFILE - dpkg -i mlat-client_${MLATCLIENTVERSION}*.deb >> $LOGFILE 2>&1 + #cd .. >> $LOGFILE + #dpkg -i mlat-client_${MLATCLIENTVERSION}*.deb >> $LOGFILE 2>&1 cd $CURRENT_DIR