-
Notifications
You must be signed in to change notification settings - Fork 1
/
dependencies.sh
executable file
·98 lines (80 loc) · 2.91 KB
/
dependencies.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
set -euo pipefail
DRA_BIN="$HOME/.local/bin/dra"
# https://flathub.org/setup/Ubuntu
function install_flatpak(){
sudo apt install -y flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
}
# https://github.com/devmatteini/dra
function install_dra(){
TMP_DIR=$(mktemp --directory)
ARCHIVE="$TMP_DIR/dra.tar.gz"
# Download latest linux musl release asset (https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8)
curl -s https://api.github.com/repos/devmatteini/dra/releases/latest \
| grep "browser_download_url.*x86_64-unknown-linux-musl" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -O "$ARCHIVE" -i -
# Extract archive and move binary to home directory
tar xf "$ARCHIVE" --strip-components=1 -C "$TMP_DIR"
mv "$TMP_DIR"/dra "$DRA_BIN"
# Post installation setup
"$DRA_BIN" completion bash >"$HOME"/.local/share/bash-completion/completions/dra
"$DRA_BIN" completion zsh >"$HOME/.local/share/zsh-completion/_dra"
# Create symlink to be able to use dra as superuser (for example when installing .deb assets)
sudo ln -sf "$DRA_BIN" /usr/local/bin/dra
}
function setup_git(){
DELTA_BIN="$HOME/.local/bin/delta"
# Check out this guide: https://askubuntu.com/questions/773455/what-is-the-correct-way-to-use-git-with-gnome-keyring-and-https-repos
sudo apt install -y libsecret-1-0 libsecret-1-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
# Install syntax-highlighting pager and diff output
# https://github.com/dandavison/delta
"$DRA_BIN" download -i -s "delta-{tag}-x86_64-unknown-linux-gnu.tar.gz" -o ~/.local/bin dandavison/delta
"$DELTA_BIN" --generate-completion bash >"$HOME"/.local/share/bash-completion/completions/delta
"$DELTA_BIN" --generate-completion zsh >"$HOME/.local/share/zsh-completion/_delta"
}
function setup_pipx(){
local python_argcomplete=""
if command -v register-python-argcomplete3 > /dev/null; then
python_argcomplete="register-python-argcomplete3"
elif command -v register-python-argcomplete > /dev/null; then
python_argcomplete="register-python-argcomplete"
else
echo "Cannot find 'register-python-argcomplete', skipping setup_pipx"
return
fi
"$python_argcomplete" pipx >"$HOME"/.local/share/bash-completion/completions/pipx
}
function install_zsh_plugins(){
sudo apt install -y zsh-autosuggestions
git clone --depth=1 https://github.com/Aloxaf/fzf-tab "$HOME/.local/share/fzf-tab"
}
sudo apt update
sudo add-apt-repository -y universe
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update
# Remove old git version
sudo apt remove -y git
sudo apt autoremove -y
sudo apt install -y git \
build-essential \
curl \
wget \
python3-pip \
python3-dev \
python3-setuptools \
pipx \
libfuse2 \
fonts-firacode \
vim \
zsh
install_flatpak
install_dra
install_zsh_plugins
setup_git
setup_pipx
# Cleanup
sudo apt autoremove -y