Skip to content
Konfekt edited this page Apr 12, 2021 · 2 revisions

The following script updates the lf executable (in ~/bin and its man page) to their latest version (on Linux 64 bit):

#!/usr/bin/env sh

# debug output and exit on error or use of undeclared variable or pipe error:
set -o xtrace -o errtrace -o errexit -o nounset -o pipefail

version="$(curl --location --head https://github.com/gokcehan/lf/releases/latest | grep -i location: | sed 's/^.*\/tag\/\([^\/]*\)\r$/\1/')"
filename="lf-linux-amd64.tar.gz"
uri_to_download="https://github.com/gokcehan/lf/releases/download/${version}/${filename}"

curl --fail --show-error --location "$uri_to_download" |
  tar -xz -C /tmp/
mv --force /tmp/lf "${HOME}/bin/lf" && 
  chmod a+x "${HOME}/bin/lf"

curl --fail --show-error --location https://raw.githubusercontent.com/gokcehan/lf/master/lf.1 --output "$HOME"/.local/share/man/man1/lf.1

if [ ! -x "${HOME}/bin/lf" ]; then
    echo '"lf" was not successfully installed!' >&2
    # DISPLAY=:0 notify-send --urgency=critical "Failed updating lf!
      # Run $0 to check."
    exit 2
fi
Clone this wiki locally