Create script to build and install power_instruction_analyzer
authorCole Poirier <colepoirier@gmail.com>
Fri, 24 Jul 2020 20:18:07 +0000 (13:18 -0700)
committerCole Poirier <colepoirier@gmail.com>
Fri, 24 Jul 2020 20:18:07 +0000 (13:18 -0700)
pia-install [new file with mode: 0755]

diff --git a/pia-install b/pia-install
new file mode 100755 (executable)
index 0000000..57f627e
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root"
+  exit
+fi
+
+export MYNAME=`id 1000 | awk '{print $1}' | sed 's/.*(\(.*\))/\1/'`
+
+runuser $MYNAME --preserve-environment -c '/bin/bash << EOF
+export PATH=/home/$MYNAME/.cargo/bin:$PATH
+export HOME=/home/$MYNAME
+if ! command -v rustup &> /dev/null
+then
+    echo -e "Rustup could not be found, it can be installed by running the following command: curl --proto \047=https\047 --tlsv1.2 -sSf https://sh.rustup.rs | sh"
+    exit
+fi
+cd /home/$MYNAME/src
+git clone https://salsa.debian.org/Kazan-team/power-instruction-analyzer.git pia
+cd pia
+maturin build --cargo-extra-args=--features=python-extension
+EOF'
+cd /home/$MYNAME/src/pia
+python3 -m pip install target/wheels/*.whl