-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirrorlist.sh
181 lines (153 loc) · 6.17 KB
/
mirrorlist.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
#!/bin/bash
# Author: Auroot/BaSierl
# QQ: 2763833502
# Description: Arch Linux 安装脚本
# URL Blog: https://basierl.github.io
# URL GitHub: https://github.com/BaSierL/arch_install.git
# URL Gitee : https://gitee.com/auroot/arch_install.git
clear;
#==============-------------mirrorlist----------------==============
cat > /etc/pacman.d/mirrorlist << EOF
################################################################################
################# Arch Linux mirrorlist generated by Reflector #################
################################################################################
# With: reflector --verbose --country China -l 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
# With: reflector --verbose --country China -l 20 --protocol http --sort rate --save /etc/pacman.d/mirrorlist
# From: https://www.archlinux.org/mirrors/status/json/
## China
Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/\$repo/os/\$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/\$repo/os/\$arch
Server = http://mirrors.163.com/archlinux/\$repo/os/\$arch
## China
Server = https://mirrors.163.com/archlinux/\$repo/os/\$arch
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/\$repo/os/\$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/\$repo/os/\$arch
EOF
echo "$(date -d "2 second" +"%Y-%m-%d %H:%M:%S") mirrorlist=yes" >> /tmp/Arch_install.log
#==============-------------pacman.conf----------------==============
cat > /etc/pacman.conf << EOF
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
CleanMethod = KeepInstalled
#UseDelta = 0.7
Architecture = auto
#IgnorePkg =
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
UseSyslog
Color
TotalDownload
CheckSpace
VerbosePkgLists
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
RemoteFileSigLevel = Required
# NOTE: You must run "pacman-key --init" before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with "pacman-key --populate archlinux".
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# 默认情况下,测试存储库被禁用。若要启用,请取消注释
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# 如果要在x86_64系统上运行32位应用程序,
# 根据需要在此启用多库存储库。
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# ArchLinux CN 腾讯源
[archlinuxcn]
Server = https://mirrors.cloud.tencent.com/archlinuxcn/\$arch
# ArchLinux CN 腾讯源
# [archlinuxcn]
# Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/\$arch
# BlackArch 官方源 渗透工具源
# [blackarch]
# SigLevel = Optional TrustAll
# Server = https://mirrors.tuna.tsinghua.edu.cn/blackarch/\$repo/os/\$arch
# ArcoLinux 官方GitHub源 1
# [arcolinux_repo]
# SigLevel = Required DatabaseOptional # 必需数据库可选
# SigLevel = Optional TrustAll #可选信任
# Server = https://arcolinux.github.io/arcolinux_repo/\$arch
# ArcoLinux 官方GitHub源 2
# [arcolinux_repo_iso]
# SigLevel = Required DatabaseOptional # 必需数据库可选
# SigLevel = Optional TrustAll #可选信任
# Server = https://arcolinux.github.io/arcolinux_repo_iso/\$arch
# Arch4edu 是面向高校用户推出的非官方软件仓库, 支持 Arch Linux 和 Arch Linux ARM, 主要包含高校用户常用的科研、教学及开发软件。
# [arch4edu]
# SigLevel = TrustAll
# Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/\$arch
# [arcolinux_repo_3party]
# SigLevel = Required DatabaseOptional
# Include = /etc/pacman.d/arcolinux-mirrorlist
# [arcolinux_repo_xlarge]
# SigLevel = Required DatabaseOptional
# Include = /etc/pacman.d/arcolinux-mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
# 本地镜像源
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
EOF
echo "$(date -d "2 second" +"%Y-%m-%d %H:%M:%S") archlinuxcn=yes" >> /tmp/Arch_install.log
sleep 1;
# 判断/tmp/Arch_install.log日志文件中是否有"archlinuxcn-keyring=yes"
# [存在] 退出 \ [不存在] 更新archlinuxcn-keyring并记录
if $(grep -q "archlinuxcn-keyring=yes" /tmp/Arch_install.log) ; then
clear;
exit 0;
else
sudo pacman -Syy archlinuxcn-keyring
echo "$(date -d "2 second" +"%Y-%m-%d %H:%M:%S") archlinuxcn-keyring=yes" >> /tmp/Arch_install.log
fi
#curl -fsSL https://gitee.com/auroot/Arch_install/tree/master > /tmp/Script_Update_initialize
#cat /tmp/Script_Update_initialize 2&> /dev/null | awk 'NR==1141{print}' | cut -d"'" -f6 | tr -cd "[0-9]" | cut -d"%" -f1 > /tmp/Script_Update_initialize