Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Automated install/update, don't forget to always verify what you're piping into
```sh
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
```
The script installs downloaded binary to `$HOME/.local/bin` directory by default, but it can be changed by setting `DIR` environment variable.
The script installs downloaded binary to `/usr/local/bin` directory by default, but it can be changed by setting `DIR` environment variable.

### Go

Expand Down Expand Up @@ -245,6 +245,12 @@ You can also use `go run main.go` to compile and run in one go (pun definitely i

Call `lazydocker` in your terminal. I personally use this a lot so I've made an alias for it like so:

```
echo "alias lzd='lazydocker'" >> ~/.bashrc
```

Or zsh:

```
echo "alias lzd='lazydocker'" >> ~/.zshrc
```
Expand Down
35 changes: 32 additions & 3 deletions scripts/install_update_linux.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/bin/bash

# allow specifying different destination directory
DIR="${DIR:-"$HOME/.local/bin"}"
# change the default destination directory to be executable as a command
DIR="${DIR:-"/usr/local/bin"}"

# check if requires sudo when the directory is not the default value
if [ ! -w "$DIR" ]; then
if [ "$EUID" -ne 0 ]; then
echo "Error: You need permissions to write in $DIR"
echo "Run the script with sudo or define DIR as a directory with write permissions:"
echo " sudo $0"
echo " DIR=\"\$HOME/.local/bin\" $0"
exit 1
fi
fi

# map different architecture variations to the available binaries
ARCH=$(uname -m)
Expand All @@ -20,5 +31,23 @@ GITHUB_URL="https://github.com/jesseduffield/lazydocker/releases/download/${GITH
# 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"

# create the directory if it doesn't exist, but requires sudo
if [ ! -d "$DIR" ]; then
if [ "$EUID" -eq 0 ]; then
mkdir -p "$DIR"
else
sudo mkdir -p "$DIR"
fi
fi

# install with correct permissions
if [ "$EUID" -eq 0 ]; then
install -Dm 755 lazydocker -t "$DIR"
else
sudo install -Dm 755 lazydocker -t "$DIR"
fi

rm lazydocker lazydocker.tar.gz

echo "lazydocker installed successfully in $DIR"