jesseduffield_lazydocker/scripts/install_update_linux.sh
Jörg Sachse 54cfd08849
remove extracted lazydocker binary
The installation method used up until now would always leave one copy of the lazydocker binary in the extraction directory. This copy is not actually needed after installation, so it should be removed. TheAxelander also pointed this out in his comment at https://github.com/jesseduffield/lazydocker/issues/270#issuecomment-1042983635.
This commit changes that behaviour and makes the install script cleanup after itself.
2022-06-14 12:03:06 +02:00

25 lines
884 B
Bash
Executable File

#!/bin/bash
# allow specifying different destination directory
DIR="${DIR:-"$HOME/.local/bin"}"
# map different architecture variations to the available binaries
ARCH=$(uname -m)
case $ARCH in
i386|i686) ARCH=x86 ;;
armv6*) ARCH=armv6 ;;
armv7*) ARCH=armv7 ;;
aarch64*) ARCH=arm64 ;;
esac
# prepare the download URL
GITHUB_LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/jesseduffield/lazydocker/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
GITHUB_FILE="lazydocker_${GITHUB_LATEST_VERSION//v/}_$(uname -s)_${ARCH}.tar.gz"
GITHUB_URL="https://github.com/jesseduffield/lazydocker/releases/download/${GITHUB_LATEST_VERSION}/${GITHUB_FILE}"
# install/update the local binary
curl -L -o lazydocker.tar.gz $GITHUB_URL
tar xzvf lazydocker.tar.gz lazydocker
install -Dm 755 lazydocker -t "$DIR"
rm lazydocker lazydocker.tar.gz