only use one variable for the install directory, currently two variables were used but only one was pointing to the user-specified location, so it would fail on custom installations (when the path was not /boot/efi/EFI/refind)
enable bash error traps, so that if an error happens, the script fails and does not continue execution, which would lead to potential bugs
download the install directory in a temporary directory, so multiple git clone do not cause a problem
To confirm that it is doing the right thing, try the old install script with an install location of /tmp/my-refind, it would still attempt to write some (not all) things to /boot/EFI/efi/refind
In particular
git clone
do not cause a problem