]> foleosoft.com Git - CryptoFoleo.git/commitdiff
Tue Jan 21 01:53:32 PM EST 2025
authorserver <[email protected]>
Tue, 21 Jan 2025 18:53:32 +0000 (13:53 -0500)
committerserver <[email protected]>
Tue, 21 Jan 2025 18:53:32 +0000 (13:53 -0500)
build.sh

index 7168f8f6cdf94d9c31e7660dfecebcbc7eecbada..2af4920961bf58293476c3c72fff6c448d53bd89 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -14,10 +14,33 @@ then
        set -x -e
        sudo cp bin/CryptoFoleo.h /usr/local/include/
        sudo cp bin/libCryptoFoleo.so /usr/local/lib/
+       set +e
+       cat /etc/profile | grep LD_LIBRARY_PATH | grep usr/local/lib
+       err=$?
+       set -e
+       if [ $err -eq 1 ]
+       then
+               cat /etc/profile > .tmp
+               echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >> .tmp
+               mv .tmp /etc/profile
+       fi
 elif [ "$1" == "uninstall" ]
 then
        set -x -e
        sudo rm /usr/local/include/CryptoFoleo.h /usr/local/lib/libCryptoFoleo.so
+       set +e
+       cat /etc/profile | grep 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib'
+       err=$?
+       set -e
+       if [ $err -eq 0 ]
+       then
+               read -p "Do you want to remove /usr/local/lib from /etc/profile? (y/n): " y
+               if [ "$y" = "y" ] || [ "$y" = "Y" ]
+               then
+                       cat /etc/profile | grep -v 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' > .tmp
+                       mv .tmp /etc/profile
+               fi
+       fi
 else
        set -x -e
        gcc -shared -fPIC src/all.c -o bin/libCryptoFoleo.so -lgmp -DDEVICE='"/dev/random"'