04cb826e1ae00cb85992b35bd770162ee7b0d761
[dev-env-setup.git] / pia-install
1 #!/bin/bash
2 if [ "$EUID" -ne 0 ]
3 then echo "Please run as root"
4 exit
5 fi
6
7 export MYNAME=`id 1000 | awk '{print $1}' | sed 's/.*(\(.*\))/\1/'`
8
9 runuser $MYNAME --preserve-environment -c '/bin/bash << EOF
10 export PATH=/home/$MYNAME/.cargo/bin:$PATH
11 export HOME=/home/$MYNAME
12 if ! command -v rustup &> /dev/null
13 then
14 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"
15 exit
16 fi
17 cd /home/$MYNAME/src
18 rustup default stable
19 rustup update
20 cargo install maturin
21 git clone https://salsa.debian.org/Kazan-team/power-instruction-analyzer.git pia
22 cd pia
23 maturin build --cargo-extra-args=--features=python-extension
24 EOF'
25 cd /home/$MYNAME/src/pia
26 python3 -m pip install target/wheels/*.whl