-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathinstall.sh
executable file
·230 lines (215 loc) · 7.23 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
230
#!/bin/bash
# 安装一些工具
install_aurman(){
if ( ! grep -i archlinuxcn /etc/pacman.conf > /dev/null 2>&1);then
$USER echo "[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf
fi
$USER pacman -Syu
$USER pacman -S archlinuxcn-keyring
$USER pacman -S aurman
}
install_layman(){
$USER emerge layman
$USER layman -L
}
# 获取发行版
get_OS(){
if (grep -i ubuntu /etc/*release > /dev/null 2>&1);then
OS=ubuntu
elif (grep -i debian /etc/*release > /dev/null 2>&1);then
OS=debian
elif (grep -i arch /etc/*release > /dev/null 2>&1);then
OS=arch
if ( ! hash aurman > /dev/null 2>&1);then
install_aurman
fi
elif (grep -i manjaro /etc/*release > /dev/null 2>&1);then
OS=manjaro
elif (grep -i fedora /etc/*release > /dev/null 2>&1);then
OS=fedora
elif (grep -i opensuse /etc/*release > /dev/null 2>&1);then
OS=opensuse
elif (grep -i solus /etc/*release > /dev/null 2>&1);then
OS=solus
elif (grep -i gentoo /etc/*release > /dev/null 2>&1);then
OS=gentoo
if ( ! hash layman > /dev/null 2>&1);then
install_layman
fi
else
OS=linux
fi
}
# 安装主题
# 目前在Linux上适配最全的主题
papirus_icon_theme(){
case $OS in
ubuntu)
$USER add-apt-repository ppa:papirus/papirus
$USER apt-get update
$USER apt-get install papirus-icon-theme
;;
debian)
$USER echo "deb http://ppa.launchpad.net/papirus/papirus/ubuntu xenial main" >> /etc/apt/sources.list.d/papirus-ppa.list
$USER apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E58A9D36647CAE7F
$USER apt-get update
$USER apt-get install papirus-icon-theme
;;
arch)
aurman -S papirus-icon-theme-git
;;
manjaro)
$USER pacman -S papirus-icon-theme
;;
fedora)
$USER wget -q https://copr.fedorainfracloud.org/coprs/dirkdavidis/papirus-icon-theme/repo/fedora-26/dirkdavidis-papirus-icon-theme-fedora-26.repo -P /etc/yum.repos.d/
$USER yum makecache
$USER yum update
$USER yum install papirus-icon-theme
;;
opensuse)
xdg-open https://software.opensuse.org/download.html\?project=home:kill_it\&package=papirus-icon-theme
;;
solus)
$USER eopkg install papirus-icon-theme
;;
gentoo)
$USER layman -a 4nykey
$USER layman -S
$USER emerge -av papirus-icon-theme
$USER etc-update --automode -3
$USER emerge -av papirus-icon-theme
;;
*)
wget -O /tmp/papirus-icon-theme.tar.gz https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/master.tar.gz
tar -xzf /tmp/papirus-icon-theme.tar.gz -C /tmp
$USER rm -r /usr/share/icons/*Papirus*
$USER mv /tmp/papirus-icon-theme-master/*Papirus* /usr/share/icons/
$USER gtk-update-icon-cache -q /usr/share/icons/*Papirus*
$USER rm -r /tmp/papirus*
;;
esac
}
# 类似谷歌的图标主题,适配比较齐全
paper_icon_theme(){
case $OS in
ubuntu)
$USER add-apt-repository ppa:snwh/pulp
$USER apt-get update
$USER apt-get install paper-icon-theme
;;
debian)
wget -O /tmp/paper-icon.deb https://snwh.org/paper/download.php\?owner=snwh\&ppa=pulp\&pkg=paper-icon-theme,16.04
$USER dpkg -i /tmp/paper-icon.deb
$USER apt-get -f install
rm /tmp/paper-icon.deb
;;
arch)
aurman -S paper-icon-theme-git
;;
manjaro)
aurman -S paper-icon-theme-git
;;
fedora)
xdg-open https://software.opensuse.org/download.html\?project=home%3Asnwh%3Apaper\&package=paper-icon-theme
;;
opensuse)
xdg-open https://software.opensuse.org/download.html\?project=home%3Asnwh%3Apaper\&package=paper-icon-theme
;;
solus)
$USER eopkg install paper-icon-theme
;;
gentoo)
$USER layman -a 4nykey
$USER layman -S
$USER emerge -av papaer-icon-theme
$USER etc-update --automode -3
$USER emerge -av papaer-icon-theme
;;
*)
$USER rm -r /tmp/paper-icon
git clone -depth 1 https://github.com/snwh/paper-icon-theme /tmp/paper-icon
$USER mv /tmp/paper-icon/Paper* /usr/share/icons
$USER gtk-update-icon-cache -q /usr/share/icons/Paper*
$USER rm -r /tmp/paper-icon
;;
esac
}
# 很棒的MD质感,但特效比较吃CPU,慎用
adapta_gtk_theme(){
case $OS in
ubuntu)
$USER add-apt-repository ppa:tista/adapta
$USER apt-get update
$USER apt-get install adapta-gtk-theme
;;
arch)
$USER pacman -S adapta-gtk-theme
;;
manjaro)
$USER pacman -S adapta-gtk-theme
;;
solus)
$USER eopkg install adapta-gtk-theme
;;
gentoo)
$USER layman -a jorgicio
$USER layman -S
$USER emerge adapta-gtk-theme
$USER etc-update --automode -3
$USER emerge adapta-gtk-theme
;;
*)
git clone -depth 1 https://github.com/Linux-Theme-Collection/GTK-Themes /tmp/adapta-gtk-theme
$USER mv /tmp/adapta-gtk-theme/themes/Adapta* /usr/share/themes
$USER rm -r /tmp/adapta-gtk-theme
;;
esac
}
# 楼上的KDE版主题,但并不吃CPU,辣鸡GTK
adapta_kde_theme() {
case $OS in
ubuntu)
$USER add-apt-repository ppa:papirus/papirus
$USER apt-get update
$USER apt-get install --install-recommends adapta-kde
;;
arch)
aurman -S adapta-kde
;;
opensuse)
xdg-open https://software.opensuse.org/download.html\?project=home:kill_it\&package=adapta-kde
;;
*)
$USER wget -O /tmp/adapta-kde.tar.gz https://github.com/PapirusDevelopmentTeam/adapta-kde/archive/master.tar.gz
$USER tar -xf /tmp/adapta-kde.tar.gz -C /tmp
cd /tmp/adapta-kde-master
$USER make install
esac
}
choose_theme(){
echo "请输入你想安装主题所对应的序号"
select theme in "papirus_icon_theme" "paper_icon_theme" "adapta_gtk_theme" "adapta_kde_theme" "quit";do
if [ "$theme" == quit ];then
exit 1
fi
$theme
exit
done
}
# Main
if [ `whoami` == root ];then
USER=''
elif (hash sudo > /dev/null 2>&1);then
USER='sudo'
else
echo "请安装sudo(当然也需要把当前用户添加到wheel用户组并修改sudo配置)或在root用户下运行"
exit
fi
if ( ! hash git > /dev/null 2>&1);then
echo "请安装Git并设置Git代理"
exit
fi
get_OS
choose_theme