-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·229 lines (207 loc) · 4.91 KB
/
install.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status
# Function to log messages
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Function to install a package if it's not already installed
install_if_not_exists() {
if ! pacman -Qi "$1" >/dev/null 2>&1; then
log "Installing $1..."
sudo pacman -S --needed --noconfirm "$1" || { log "Failed to install $1"; exit 1; }
else
log "$1 is already installed."
fi
}
# Function to install an AUR package if it's not already installed
install_aur_if_not_exists() {
if ! pacman -Qi "$1" >/dev/null 2>&1; then
log "Installing $1 from AUR..."
paru -S --needed --noconfirm "$1" || { log "Failed to install $1"; exit 1; }
else
log "$1 is already installed."
fi
}
# List of official packages to be installed
official_packages=(
vim
libinput
interception-tools
libevdev
glibc
git
kitty
gcc
gimp
wget
pavucontrol
less
openssl
inkscape
reflector
sox
deno
qutebrowser
thunderbird
feh
jq
lsof
tldr
postgresql
redis
tmux
tree
ufw
wofi
git
make
unzip
ripgrep
fd
unzip
neovim
thunar
exfat-utils
dosfstools
luarocks
gvfs
polkit-gnome
nushell
)
# List of AUR packages to be installed
aur_packages=(
deluge
starship
wl-clipboard
brightnessctl
yaml-cpp
waybar
hyprpaper
eza
flatpak
nerd-fonts
adwaita-dark
docker-compose
zoom
discord
obs-studio
blueberry
deluge-gtk
spotify-snapstore
extra/rofi-wayland
# rofi-lbonn-wayland-git
rofi-emoji-git
ttf-twemoji
wtype
zoxide
bat
fzf
p7zip
npm
nodejs
wev
grim
slurp
rsync
figma-linux
ttf-twemoji
entr
mpv
nwg-look
ant-dracula-theme-git
act
dracula-icons-git
1password
ungoogled-chromium-bin
plocate
fx
google-earth-pro
luajit-tiktoken-bin
btop
obsidian
carapace-bin
)
# Update the system
log "Updating the system..."
sudo pacman -Syu || { log "System update failed"; exit 1; }
# Install official packages
for package in "${official_packages[@]}"; do
install_if_not_exists "$package"
done
# Check if SSHD service is running
if ! systemctl is-active --quiet sshd; then
log "Starting and enabling SSHD service..."
sudo systemctl start sshd || { log "Failed to start SSHD service"; exit 1; }
sudo systemctl enable sshd || { log "Failed to enable SSHD service"; exit 1; }
else
log "SSHD is already running."
fi
# Configure git
log "Configuring git..."
git config --global user.email "eboodnero@gmail.com"
git config --global user.name "Eran Boodnero"
# Install Rust stable
log "Installing Rust stable..."
rustup install stable || { log "Failed to install Rust stable"; exit 1; }
# Install paru if it's not already installed
if ! command_exists paru; then
log "Installing Paru..."
git clone https://aur.archlinux.org/paru.git || { log "Failed to clone paru repository"; exit 1; }
(cd paru && makepkg -si) || { log "Failed to install paru"; exit 1; }
rm -rf paru
else
log "Paru is already installed."
fi
# Install AUR packages
for package in "${aur_packages[@]}"; do
install_aur_if_not_exists "$package"
done
# Run additional setup scripts
scripts=(
"docker_setup.sh"
"pull_config.sh"
"tmux_tpm.sh"
"rofi_theme.sh"
"aliases.sh"
"update_dns.sh"
"obsidian_setup.sh"
# "laptop_setup.sh"
)
for script in "${scripts[@]}"; do
if [ -f "$HOME/scripts/$script" ]; then
log "Running $script..."
sh "$HOME/scripts/$script" || { log "Failed to run $script"; exit 1; }
else
log "Warning: $script not found in $HOME/scripts/"
fi
done
# Set up 1password ssh agent
grep -q 'export SSH_AUTH_SOCK=~/.1password/agent.sock' ~/.bashrc || echo 'export SSH_AUTH_SOCK=~/.1password/agent.sock' >> ~/.bashrc
# Install Cargo packages
cargo_packages=(
"typeshare-cli"
"cargo-watch"
"cargo-script"
"cargo-run-script"
"sccache"
"jinja-lsp"
)
for package in "${cargo_packages[@]}"; do
if ! cargo install --list | grep -q "^$package v"; then
log "Installing $package..."
cargo install "$package" || { log "Failed to install $package"; exit 1; }
else
log "$package is already installed."
fi
done
# Create a gitignore that ignores everything in .config
[ -f ~/.config/.gitignore ] || echo "*" > "$HOME/.config/.gitignore"
# Set timezone and hardware clock
log "Setting timezone and hardware clock..."
sudo timedatectl set-timezone America/Los_Angeles || { log "Failed to set timezone"; exit 1; }
sudo hwclock --systohc --utc || { log "Failed to set hardware clock"; exit 1; }
log "Installation and setup completed successfully."