-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_install_software.sh
55 lines (43 loc) · 1.24 KB
/
run_install_software.sh
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
51
52
53
54
55
#!/bin/bash
# This is run_ rather than run_onchange so that it somewhat-repeatedly nags the
# user to install missing software.
apt_packages_to_install=
dpkg_is_installed() {
dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -q 'install ok installed'
}
check_apt() {
for alternate in "$@"; do
dpkg_is_installed $alternate && return
done
apt_packages_to_install="$apt_packages_to_install $(echo $* | sed 's/ /|/g')"
}
check_custom() {
name="$1"
binary="$2"
installation="$3"
hash $binary > /dev/null 2>&1 && return
echo "$name not found: $installation"
}
check_apt bidiv
check_apt btop
check_apt entr
check_apt exa eza
check_apt fd-find
check_apt fish
check_apt fzf
check_apt ripgrep
check_apt tmux
if [[ -d ~/.local/share/chezmoi.work ]]; then
# At work, use apt version of bat
check_apt bat
else
check_apt keychain
# not-at-work, use latest version of bat
check_custom bat bat "https://github.com/sharkdp/bat/releases"
check_custom delta delta "https://dandavison.github.io/delta/installation.html"
check_custom lazydocker lazydocker "https://github.com/jesseduffield/lazydocker"
fi
if [[ -n "$apt_packages_to_install" ]]; then
echo "Missing apt packages:"
echo "sudo apt install ${apt_packages_to_install# }"
fi