Remove use of uid=1000 in favour of $SUDO_USER globally
[dev-env-setup.git] / pia-install
index 04cb826e1ae00cb85992b35bd770162ee7b0d761..7ed614777636ea9d2f920bb46bf21fb60c88c867 100755 (executable)
@@ -1,26 +1,14 @@
 #!/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
+cd /home/$USER/src
 rustup default stable
 rustup update
 cargo install maturin
 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
+python3 -m pip install --user target/wheels/*.whl