AdnanHodzic / displaylink-debian

DisplayLink driver installer for Debian and Ubuntu based Linux distributions.
https://foolcontrol.org/?p=1777
GNU General Public License v3.0
1.29k stars 229 forks source link

Uninstall failure - `bash: /opt/displaylink/displaylink-installer.sh: No such file or directory` #380

Closed robotard closed 4 years ago

robotard commented 4 years ago

Nice and easy one in such that I've pretty much isolated the problem and coded a fix (read below though pls before I push)

There's a bug preventing uninstallation (and I think reinstallation too), not finding "displaylink-installer.sh", which appears to not actually be copied to "/opt/diplaylink" during installation... You see the error below:

bash: /opt/displaylink/displaylink-installer.sh: No such file or directory

Interestingly, if you manually copy it there (or use the script below that I knocked together), then when uninstallation from our script has completed, it has removed the "/opt/displaylink" folder as part of cleanup...

Ok, so I've put together this little script (makeopt.sh) to get around the issue to allow me to fully test instal/uninstall in general...

#!/bin/bash

#./5.2/displaylink-driver-5.2

# Quick hardcoded fix for displaylink-debian uninstallation failure
# Stick this in the displaylink-debian folder
# It assumes that we have a 5.2 folder in there (can get from installation)

driverfolder="./5.2/displaylink-driver-5.2/"
#I've copied the current version folder to the below for my testing
#driverfolder="./5.2bak/displaylink-driver-5.2/"
echo "$driverfolder"
optfolder="/opt/displaylink"

if [ -d  $driverfolder ]
then
    echo "Exists, lets copy to $optfolder"
    #check if folder exists
    if [ ! -d $optfolder ]
    then
        mkdir $optfolder
        echo "created $optfolder"
    fi
    cp -r $driverfolder* $optfolder
    echo "copied files"
    ls $optfolder
else
    echo "Oh really, no driver folder?"
fi

Now this works just fine, but I've tried implementing with our current $driver_dir into the post_install() method and grabbing the correct folder for the current version that we have downloaded (see path below), but for some strange reason my if [ -d ] check on this folder seems to not find the folder. I've even tried moving it to the top of post_install()

"$driver_dir/displaylink-driver-${version}"

Am sure there is something very tiny that I'm missing, and as I said, it addresses the above bug. Am more than happy to push the version of displaylink-debian.sh with the "fix" commented out, and then you'll only have to mend the folder path check?

It's an odd one, but don't want to open a new bug when the premise fix in my code just needs a little nudge in the right direction ;)

Let me know what your thoughts are...

MaiKuraki commented 4 years ago

thanks! I got this problem, and your solution works well!

robotard commented 4 years ago

You're very welcome... Adnan et al definitely did the main brunt of the work, so massive kudos to them too :)