From e0319411315148b9f4b66ac5eade9718785f3fad Mon Sep 17 00:00:00 2001 From: Mxzcabel Date: Thu, 3 Oct 2024 11:42:22 -0300 Subject: [PATCH] V3.19.0 -- Fix library symbolic link (Patch) --- nordvpn-bin.install | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/nordvpn-bin.install b/nordvpn-bin.install index 8305f19..ee260ed 100644 --- a/nordvpn-bin.install +++ b/nordvpn-bin.install @@ -5,10 +5,26 @@ post_install() { echo " sudo gpasswd -a USERNAME nordvpn" echo ':: You then have to restart for the group to be created:' echo " reboot" - + # Add logic to avoid interposing with sqlite library if it already exists for lib in /usr/lib/nordvpn/*.so ; do if [ -f "$lib" ] ; then - ln -s $lib /usr/lib/ + if [ ! -f /usr/lib/$(echo $lib | cut -d '/' -f 5) ] ; then + ln -s $lib /usr/lib/ + fi + fi + done +} + +post_upgrade() { + # Add logic to avoid interposing with sqlite library if it already exists + for lib in /usr/lib/nordvpn/*.so ; do + if [ -f "$lib" ] ; then + if [ $(readlink -- "/usr/lib/$(echo $lib | cut -d '/' -f 5)") = "$lib" ] ; then + ln -sf $lib /usr/lib/ + fi + if [ ! -f /usr/lib/$(echo $lib | cut -d '/' -f 5) ] ; then + ln -s $lib /usr/lib/ + fi fi done } @@ -23,19 +39,14 @@ pre_upgrade() { chattr -i /var/lib/nordvpn/data/* } -post_upgrade() { - for lib in /usr/lib/nordvpn/*.so ; do - if [ -f "$lib" ] ; then - ln -sf $lib /usr/lib/ - fi - done -} - pre_remove() { chattr -i /var/lib/nordvpn/data/* + # Add logic to avoid interposing with sqlite library if it already exists for lib in /usr/lib/nordvpn/*.so ; do if [ -f "$lib" ] ; then - unlink /usr/lib/$(echo $lib | cut -d '/' -f 5) + if [ $(readlink -- "/usr/lib/$(echo $lib | cut -d '/' -f 5)") = "$lib" ] ; then + unlink /usr/lib/$(echo $lib | cut -d '/' -f 5) + fi fi done }