-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlazydocker.sh
More file actions
51 lines (45 loc) · 1.6 KB
/
Copy pathlazydocker.sh
File metadata and controls
51 lines (45 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# name: LazyDocker
# version: 1.0
# description: lazydocker_desc
# icon: docker.svg
# nocontainer
# --- Start of the script code ---
source "$SCRIPT_DIR/libs/linuxtoys.lib"
_lang_
# The official LazyDocker installer places the binary under
# $HOME/.local/bin and needs no root privileges,
# so we avoid requesting elevation entirely (least privilege).
lazydocker_in () {
local tempfile
command -v docker &>/dev/null || die "No docker installation found. Aborting."
prep_tmp # the upstream installer downloads/extracts into cwd, so pin it to /tmp/linuxtoys
if [ ! -f "$HOME/.local/bin/lazydocker" ]; then
prep_create "$HOME/.local/bin/lazydocker"
rm -f "$HOME/.local/bin/lazydocker"
else
info "$notdomsg"
fi
tempfile=$(mktemp)
curl -fsSL \
https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh \
-o "$tempfile" \
|| die "Failed to download installer"
bash "$tempfile" \
|| die "Failed to install LazyDocker"
rm -f "$tempfile"
for rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do
if [ -f "$rc" ] && ! grep -q '\.local/bin' "$rc"; then
prep_edit "$rc"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"
fi
done
fish_config="$HOME/.config/fish/config.fish"
if [ -f "$fish_config" ] && ! grep -q '\.local/bin' "$fish_config"; then
prep_edit "$fish_config"
echo 'set -gx PATH $HOME/.local/bin $PATH' >> "$fish_config"
fi
export PATH="$HOME/.local/bin:$PATH"
}
lazydocker_in
info "$finishmsg"