-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall2.sh
274 lines (246 loc) · 7.54 KB
/
install2.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/bash
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc --utc
if [ $? -eq 0 ]; then
echo "Time zone change success "
else
echo "Time zone change failed "
exit -1
fi
echo -e "en_US.UTF-8 UTF-8 \nzh_CN.UTF-8 UTF-8 \nzh_TW.UTF-8 UTF-8" >>/etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >/etc/locale.conf
if [ $? -eq 0 ]; then
echo "(Mainland China) Language change success "
else
echo "(Mainland China) Language change failed "
exit -1
fi
echo "root passed:"
passwd
read -p "\nNormal user " username
useradd -m -G wheel $username
echo "\n$username passwd"
passwd $username
if [ $? -eq 0 ]; then
echo "user $username add success "
else
echo "user $username add failed "
exit -1
fi
read -n1 -p "\ninstall nvidia? [y/n]" nvidia
read -n1 -p "\nenable multiple systems support?[y/n]" multiplesupport
if [[ $multiplesupport =~ ^[Yy]$ ]]; then
read -n1 -p "\nenable ntfs filesystem support?[y/n]" ntfs3gsupport
fi
read -p "\nhostname:" userhostname
echo $userhostname >>/etc/hostname
if [ $? -eq 0 ]; then
echo "change hostname success "
else
echo "change hostname failed "
exit -1
fi
echo "[1]if install kde with sddm ?-------[default]"
echo "[2]if install gnome with gdm?"
echo "[3]if install deepin with lightdm?"
echo "[4]if install xfce4 with sddm?"
echo "[5]if install sway?"
echo "[6]skip this step"
read -n1 -p "which would you want to install ?[1/2/3/4/5/6]" desktop
if [[ $desktop =~ ^[1]$ ]]; then
read -n1 -p "would you want to install kde-applications?[y/n]" kdeapplications
elif [[ $desktop =~ ^[4]$ ]]; then
read -n1 -p "would you want to install ?[y/n]" xfce4-goodies
fi
echo -e " [archlinuxcn] \n Include = /etc/pacman.d/archlinuxcn-mirrorlist " >>/etc/pacman.conf
echo -e "Server = https://mirrors.bfsu.edu.cn/archlinuxcn/\$arch \nServer = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch \nServer = https://mirrors.hit.edu.cn/archlinuxcn/\$arch" >/etc/pacman.d/archlinuxcn-mirrorlist
sed -i 's/#Color/Color/g' /etc/pacman.conf
rm /etc/pacman.d/gnupg -rf
pacman-key --init
pacman-key --populate
pacman-key --lsign farseerfc@archlinux.org
pacman -Syy archlinuxcn-keyring --noconfirm
pacman -S archlinuxcn-mirrorlist-git --noconfirm
if [ $? -eq 0 ]; then
echo "change mirror success"
else
echo "change mirror failed"
exit -1
fi
pacman -S grub efibootmgr dosfstools --noconfirm
if [ $? -eq 0 ]; then
echo "grub success"
else
echo "grub failed"
exit -1
fi
if [[ $nvidia =~ ^[Yy]$ ]]; then
echo "install nvidia ing"
pacman -S nvidia --noconfirm
if [ $? -eq 0 ]; then
echo "os-prober success"
else
echo "os-prober failed"
exit -1
fi
fi
if [[ $multiplesupport =~ ^[Yy]$ ]]; then
echo "GRUB_DISABLE_OS_PROBER=false" >>/etc/default/grub
pacman -S os-prober --noconfirm
if [ $? -eq 0 ]; then
echo "os-prober success"
else
echo "os-prober failed"
exit -1
fi
if [[ $ntfs3gsupport =~ ^[Yy]$ ]]; then
pacman -S ntfs-3g --noconfirm
if [ $? -eq 0 ]; then
echo "ntfs-3g install success"
else
echo "ntfs-3g install failed"
exit -1
fi
fi
fi
echo "build grub "
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck
grub-mkconfig -o /boot/grub/grub.cfg
if [ $? -eq 0 ]; then
echo "grub success"
else
echo "grub failed"
exit -1
fi
echo "fonts installing ( Google Noto Fonts , Source Han Sans CN, Source Han Serif CN, Sarasa Gothic )"
pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-sarasa-gothic --noconfirm
if [ $? -eq 0 ]; then
echo "install fonts success"
else
echo "install fonts failed"
exit -1
fi
echo "network manager installing"
pacman -S networkmanager --noconfirm
systemctl enable NetworkManager
if [ $? -eq 0 ]; then
echo "network managersuccess"
else
echo "network managerfailed"
exit -1
fi
echo "%wheel ALL=(ALL:ALL) ALL" >>/etc/sudoers
echo "blue tooth installing"
pacman -S bluez bluez-utils pulseaudio-bluetooth --noconfirm
modprobe btusb
systemctl enable bluetooth.service
if [ $? -eq 0 ]; then
echo "bluetooth success"
else
echo "bluetooth failed"
exit -1
fi
if [[ $desktop =~ ^[1]$ ]]; then
pacman -S sddm plasma --noconfirm
systemctl enable sddm
if [ $? -eq 0 ]; then
echo "kde success"
else
echo "kde failed"
exit -1
fi
if [[ $kdeapplications =~ ^[Yy]$ ]]; then
pacman -S kde-applications --noconfirm
if [ $? -eq 0 ]; then
echo "kde-applications success"
else
echo "kde-applications failed"
exit -1
fi
fi
elif [[ $desktop =~ ^[2]$ ]]; then
pacman -S gnome --noconfirm
systemctl enable gdm
if [ $? -eq 0 ]; then
echo "gnome success"
else
echo "gnome failed"
exit -1
fi
elif [[ $desktop =~ ^[3]$ ]]; then
pacman -S deepin lightdm xorg-server --noconfirm
systemctl enable lightdm
if [ $? -eq 0 ]; then
echo "lightdm success"
else
echo "lightdm failed"
exit -1
fi
elif [[ $desktop =~ ^[4]$ ]]; then
pacman -S sddm xfce4 --noconfirm
systemctl enable sddm
if [ $? -eq 0 ]; then
echo "xfce4 success"
else
echo "xfce4 failed"
exit -1
fi
if [[ $xfce4-goodies =~ ^[Yy]$ ]]; then
pacman -S xfce4-goodies --noconfirm
if [ $? -eq 0 ]; then
echo "xfce4-goodies success"
else
echo "xfce4-goodies failed"
exit -1
fi
fi
elif [[ $desktop =~ ^[5]$ ]]; then
pacman -S sway waybar xorg-xwayland --noconfirm
if [ $? -eq 0 ]; then
echo "sway success"
else
echo "sway failed"
exit -1
fi
elif [[ $desktop =~ ^[6]$ ]]; then
echo "skip success"
fi
echo "pinyin installing"
pacman -S fcitx5-im fcitx5-chinese-addons fcitx5-pinyin-zhwiki --noconfirm
echo "GTK_IM_MODULE=fcitx" >>/etc/environment
echo "QT_IM_MODULE=fcitx" >>/etc/environment
echo "XMODIFIERS=@im=fcitx" >>/etc/environment
echo "SDL_IM_MODULE=fcitx" >>/etc/environment
echo "GLFW_IM_MODULE=ibus" >>/etc/environment
echo "$usernameuser language configing"
mkdir /home/$username/.config
chown $username:$username /home/$username/.config
echo -e "LANG=zh_CN.UTF-8\nLC_CTYPE=\"zh_CN.UTF-8\"\nLC_NUMERIC=\"zh_CN.UTF-8\"\nLC_TIME=\"zh_CN.UTF-8\"\n
LC_COLLATE=\"zh_CN.UTF-8\"\nLC_MONETARY=\"zh_CN.UTF-8\"\nLC_MESSAGES=\"zh_CN.UTF-8\"\nLC_PAPER=\"zh_CN.UTF-8\"\n
LC_NAME=\"zh_CN.UTF-8\"\nLC_ADDRESS=\"zh_CN.UTF-8\"\nLC_TELEPHONE=\"zh_CN.UTF-8\"\nLC_MEASUREMENT=\"zh_CN.UTF-8\"\n
LC_IDENTIFICATION=\"zh_CN.UTF-8\"\nLC_ALL= " >/home/$username/.config/locale.conf
chown $username:$username /home/$username/.config/locale.conf
if [ $? -eq 0 ]; then
echo "$username user languageconfig success"
else
echo "$username user languageconfig failed"
exit -1
fi
echo "zsh configing"
pacman -S zsh yay oh-my-zsh-git zsh-syntax-highlighting zsh-autosuggestions --noconfirm
yay -S autojump --noconfirm
chsh -s /bin/zsh $username
ln -s /usr/share/zsh/plugins/zsh-syntax-highlighting /usr/share/oh-my-zsh/custom/plugins/
ln -s /usr/share/zsh/plugins/zsh-autosuggestions /usr/share/oh-my-zsh/custom/plugins/
cp /usr/share/oh-my-zsh/zshrc /home/$username/.zshrc
chown $username:$username /home/$username/.zshrc
sed -i 's/plugins=(git)/plugins=(autojump sudo git colored-man-pages zsh-syntax-highlighting zsh-autosuggestions)/g' /home/$username/.zshrc
if [ $? -eq 0 ]; then
echo "zshconfig success"
else
echo "zshconfig failed"
exit -1
fi
echo "exit && reboot enter arch quickly"
exit 0