-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-ubuntu-machine.sh
executable file
·116 lines (104 loc) · 2.66 KB
/
setup-ubuntu-machine.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
function _nix() {
if [ -f "$(which nix)" ]; then
return 0
else
sh <(curl -L https://nixos.org/nix/install) --daemon
fi
}
function _fzf() {
if [ -f "$(which fzf)" ]; then
return 0
else
git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME"/.fzf
yes | "$HOME"/.fzf/install
fi
}
function _wezterm() {
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
}
function _stylua() {
if [ -f "$(which stylua)" ]; then
return 0
else
cd "$HOME"/Downloads/ || return 1
curl -LO https://github.com/JohnnyMorganz/StyLua/releases/download/v0.20.0/stylua-linux-x86_64.zip
sudo unzip stylua-linux-x86_64.zip -d /usr/local/bin/
[[ $? -eq 0 ]] && rm "$HOME"/Downloads/stylua-linux-x86_64.zip
fi
}
function _eza() {
if [ -f "$(which eza)" ]; then
return 0
else
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
fi
}
function _starship() {
if [ -f "$(which starship)" ]; then
return 0
else
curl -sSL https://starship.rs/install.sh | sudo sh -s -- -y
fi
}
function _direnv() {
if [ -f "$(which direnv)" ]; then
return 0
else
export bin_path="/usr/local/bin"
curl -sfL https://direnv.net/install.sh | sudo bash
fi
}
function _zap() {
zsh <(curl -sL https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) \
--branch release-v1
}
function _wl-clipboard() {
if [ -f "$(which wl-copy)" ]; then
return 0
else
sudo apt install -y wl-clipboard
fi
}
function _dependencies() {
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y rclone \
git \
curl \
wget \
zsh \
fd-find \
ripgrep \
stow \
sudo \
lua5.1 \
liblua5.1-0 \
build-essential \
apt-transport-https \
ca-certificates \
lsb-release
}
function _dotfiles() {
cd "$HOME" || return 1
git clone https://github.com/reaper8055/dofiles "$HOME"/dotfiles
for FILE in "$HOME"/.zshrc*; do
rm "$FILE"
done
cd "$HOME"/dotfiles && stow .
builtin source "$HOME"/.zshrc
}
_dependencies
_zap
_fzf
_stylua
_eza
_starship
_direnv
_wl-clipboard
_dotfiles