-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharch_post.sh
executable file
·224 lines (217 loc) · 7.31 KB
/
arch_post.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
#!/bin/bash -i
###############################################################################
# Author : Francisco Carpio
# Github : https://github.com/fcarp10
###############################################################################
# This script has been inspired by Arcolinux scripts created by Erik Dubois.
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK.
###############################################################################
BLUE='\033[0;34m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
RED='\033[0;31m'
NO_COLOR='\033[0m'
function log {
if [[ $1 == "INFO" ]]; then
printf "${BLUE}INFO:${NO_COLOR} %s \n" "$2"
elif [[ $1 == "DONE" ]]; then
printf "${GREEN}SUCCESS:${NO_COLOR} %s \n" "$2"
elif [[ $1 == "WARN" ]]; then
printf "${ORANGE}WARNING:${NO_COLOR} %s \n" "$2"
else
printf "${RED}FAILED:${NO_COLOR} %s \n" "$2"
fi
}
function install_package {
log "INFO" "installing packages from $1 file, please wait..."
cat <"$1" | while read -r y; do
if [[ $y != \#* ]] && [ -n "$y" ]; then
if paru -Qi "$y" &>/dev/null; then
log "WARN" "the package $y is already installed"
else
log "INFO" "installing package $y"
paru -S --noconfirm --needed "$y"
fi
fi
done
log "INFO" "done"
}
usage='Usage:
'$0' [OPTION]
OPTIONS:
-p \t Installs paru
-ba \t Installs audio
-bb \t Installs bluetooth
-bl \t Installs laptop
-bn \t Installs network
-hs \t Installs hyprland
-a \t Installs apps
-ae \t Installs apps extra
-ac \t Installs cli
-ad \t Installs dev
-ao \t Installs office
-ap \t Installs pass
-at \t Installs theme
-ma \t Installs mobile apps
-t \t Installs printers
-k \t Installs kvm
-vs \t Installs vscodium extensions
-g \t Installs gaming
-c \t Applies global configuration
-cd \t Pulls dotfiles
-cm \t Applies mobile configuration
-h \t Shows available options
Only one option is allowed
'
while [ "$1" != "" ]; do
case $1 in
-p)
log "INFO" "installing paru... please wait"
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru || exit
makepkg -si
log "INFO" "done"
;;
-ba)
install_package 0_audio.txt
systemctl --user enable --now pipewire.socket
systemctl --user enable --now pipewire-pulse.socket
systemctl --user enable --now wireplumber.service
;;
-bb)
install_package 0_bluetooth.txt
log "INFO" "enabling bluetooth service..."
sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service
sudo sed -i 's|#AutoEnable=false|AutoEnable=true|g' /etc/bluetooth/main.conf
log "INFO" "done"
;;
-bl)
install_package 0_laptop.txt
log "INFO" "enabling auto-cpufreq service..."
sudo systemctl enable auto-cpufreq.service
log "INFO" "enabling thermald service..."
sudo systemctl enable thermald.service
log "INFO" "done"
;;
-bn)
install_package 0_network.txt
log "INFO" "done"
;;
-hs)
install_package 1_hyprland.txt
sudo cp usr/local/bin/hypr-run /usr/local/bin/
log "INFO" "enabling swayosd service..."
sudo systemctl enable --now swayosd-libinput-backend.service
log "INFO" "done"
;;
-a)
install_package 2_apps.txt
;;
-ae)
install_package 2_apps_extra.txt
;;
-ac)
install_package 2_cli.txt
;;
-ad)
install_package 2_dev.txt
;;
-ao)
install_package 2_office.txt
;;
-ap)
install_package 2_pass.txt
;;
-at)
install_package 2_theme.txt
;;
-ma)
install_package 3_mobileapps.txt
;;
-t)
install_package 10_printers.txt
log "INFO" "enabling cups service..."
sudo systemctl enable cups
log "INFO" "done"
;;
-k)
install_package 20_kvm.txt
log "INFO" "enabling libvirtd service..."
sudo systemctl enable --now libvirtd.service
log "INFO" "done"
;;
-g)
install_package 40_gaming.txt
sudo modprobe i2c-dev
sudo modprobe i2c-piix4
;;
-vs)
log "INFO" "installing vscodium extensions... please wait"
cat 30_vscodium.txt | while read y; do
if [[ $y != \#* ]] && [ -n "$y" ]; then
vscodium --install-extension $y
fi
done
log "INFO" "done"
;;
-c)
log "INFO" "applying global configuration... please wait"
timedatectl set-ntp true
timedatectl set-timezone Europe/Berlin
log "INFO" "installing oh-my-zsh and plugins"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/marlonrichert/zsh-autocomplete ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete
log "INFO" "generating locale..."
sudo cp etc/locale.gen /etc/
log "INFO" "copying autologin conf..."
sudo mkdir /etc/systemd/system/[email protected]
sudo cp etc/systemd/system/[email protected]/autologin.conf /etc/systemd/system/[email protected]/
log "WARN" "remember to edit user in /etc/systemd/system/[email protected]/autologin.conf"
sudo locale-gen
log "INFO" "copying pacman conf..."
sudo cp etc/pacman.conf /etc/pacman.conf
log "INFO" "changing papirus folder theme..."
papirus-folders -C red
log "INFO" "setting up docker..."
sudo usermod -aG docker "$USER"
newgrp docker
log "INFO" "setting alacritty default for nemo..."
gsettings set org.cinnamon.desktop.default-applications.terminal exec alacritty
log "INFO" "setting nemo default file manager"
xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search
log "INFO" "adding virtualenv to pyenv..."
git clone https://github.com/pyenv/pyenv-virtualenv.git "$(pyenv root)"/plugins/pyenv-virtualenv
log "INFO" "change default shell"
chsh -s /bin/zsh "$USER"
;;
-cd)
log "INFO" "pulling dotfiles... please wait"
echo "alias gdots='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >>$HOME/.bashrc
git clone --bare https://github.com/fcarp10/dotfiles.git $HOME/.dotfiles
source $HOME/.bashrc
gdots reset --hard
gdots checkout
gdots config --local status.showUntrackedFiles no
log "INFO" "done"
;;
-cm)
log "INFO" "applying mobile configuration... please wait"
sudo cp mobile/etc/environment /etc/environment
log "INFO" "done"
;;
-h)
echo -e "${usage}"
exit 1
;;
*)
echo -e "Invalid option $1 \n\n${usage}"
exit 0
;;
esac
shift
done