From 5886611082657b0f274593dc688060b8dffbe8f2 Mon Sep 17 00:00:00 2001 From: Egor00f Date: Sat, 9 Nov 2024 12:38:41 +0000 Subject: [PATCH] fix install and prerm --- install.sh | 19 ++++++++++--------- package/DEBIAN/postrm | 4 +++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 4be146f..ac80ce2 100755 --- a/install.sh +++ b/install.sh @@ -123,17 +123,18 @@ sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4 print_ok "Successfully!" -if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then - export PATH=$PATH:/home/autobuild/tools/win32/bin - print_msg "Adding '$TOOLCHAIN_DIR/win32/bin' to '~/.bashrc'" - echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc -fi -if ["$EUID" -ne 0 ] -then - echo 'PATH=$PATH:/home/autobuild/tools/win32/bin' >> /etc/profile + +if [ ! "$(id -u)" -ne 0 ] +then + print_msg "Add" + echo 'PATH=$PATH:/home/autobuild/tools/win32/bin' >> /etc/profile else - print_msg "You must be logined as root!" + if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then + export PATH=$PATH:/home/autobuild/tools/win32/bin + print_msg "Adding '$TOOLCHAIN_DIR/win32/bin' to '~/.bashrc'" + echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc + fi fi cd "$OLDPWD" diff --git a/package/DEBIAN/postrm b/package/DEBIAN/postrm index 4843295..d408280 100755 --- a/package/DEBIAN/postrm +++ b/package/DEBIAN/postrm @@ -2,4 +2,6 @@ rm -R /home/autobuild/tools/win32 -sed -i 'PATH=$PATH:/home/autobuild/tools/win32/bin' /etc/profile +if grep -q 'PATH=$PATH:/home/autobuild/tools/win32/bin' /etc/profile; then + sed -i 'PATH=$PATH:/home/autobuild/tools/win32/bin' /etc/profile +fi