@@ -84,6 +84,17 @@ _arch4edu_install() {
8484 _arch4edu_apppend_repo
8585}
8686
87+ _archlinuxcn_install () {
88+ if _has_repo " archlinuxcn" ; then
89+ _msg_warn " archlinuxcn repository already exists in pacman configuration."
90+ return 0
91+ fi
92+
93+ _archlinuxcn_install_keyring
94+ _archlinuxcn_install_pkgs
95+ _archlinuxcn_apppend_repo
96+ }
97+
8798_chaotic_install () {
8899 if _has_repo " chaotic-aur" ; then
89100 _msg_warn " chaotic-aur repository already exists in pacman configuration."
@@ -170,20 +181,40 @@ _chaotic_install_keyring() {
170181 _pacman_key --finger " $_key_id "
171182}
172183
173- _chaotic_install_pkgs () {
174- # Prepare chaotic-mirrorlist
175- _chaotic_mirrorlist > " $tmp_dir /chaotic-mirrorlist"
184+ _blackarch_keyring_files () {
185+ local _url=" https://www.blackarch.org/keyring/"
176186
177- # Prepare chaotic.conf
178- local _conf_file=" $tmp_dir /chaotic.conf"
179- _pacman_conf > " $_conf_file "
180- _repo_config chaotic-aur " $tmp_dir /chaotic-mirrorlist" >> " $_conf_file "
187+ if ! curl -fsSL " $_url " \
188+ | awk -F ' "' ' /<a href="[^"]+"/ {print $2}' \
189+ | grep -v ' /$' \
190+ | sed " s|^|$_url |" ; then
191+ _msg_error " failed to fetch keyring file list from $_url "
192+ return 1
193+ fi
194+ }
181195
182- # Install chaotic-keyring using the temporary config
183- local _old_config_path=" $config_path "
184- config_path=" $_conf_file "
185- _pacman_S -y chaotic-keyring chaotic-mirrorlist
186- config_path=" $_old_config_path "
196+ _blackarch_keyring_version () {
197+ local _v
198+ _v=$( _blackarch_keyring_files \
199+ | awk -F/ ' {print $NF}' \
200+ | sed -En ' s/^blackarch-keyring-([0-9]{8})\.tar\.gz(\.sig)?$/\1/p' \
201+ | sort | tail -n1) || true
202+ [[ -n " $_v " ]] || {
203+ _msg_error " failed to determine blackarch keyring version"
204+ return 1
205+ }
206+ printf ' %s\n' " $_v "
207+ }
208+
209+ _blackarch_keyring_latest_files () {
210+ local _ver _urls
211+ _ver=$( _blackarch_keyring_version) || return 1
212+ _urls=$( _blackarch_keyring_files | grep " blackarch-keyring-${_ver} \.tar\.gz" ) || true
213+ [[ -n " $_urls " ]] || {
214+ _msg_error " failed to find keyring files for version $_ver "
215+ return 1
216+ }
217+ printf ' %s\n' " $_urls "
187218}
188219
189220_blackarch_install_pkgs () {
@@ -234,44 +265,24 @@ _arch4edu_install_pkgs() {
234265 config_path=" $_old_config_path "
235266}
236267
237- _blackarch_apppend_repo () {
238- _repo_config blackarch " /etc/pacman.d/blackarch-mirrorlist" >> " $config_path "
239- }
240-
241- _blackarch_keyring_files () {
242- local _url=" https://www.blackarch.org/keyring/"
268+ _chaotic_install_pkgs () {
269+ # Prepare chaotic-mirrorlist
270+ _chaotic_mirrorlist > " $tmp_dir /chaotic-mirrorlist"
243271
244- if ! curl -fsSL " $_url " \
245- | awk -F ' "' ' /<a href="[^"]+"/ {print $2}' \
246- | grep -v ' /$' \
247- | sed " s|^|$_url |" ; then
248- _msg_error " failed to fetch keyring file list from $_url "
249- return 1
250- fi
251- }
272+ # Prepare chaotic.conf
273+ local _conf_file=" $tmp_dir /chaotic.conf"
274+ _pacman_conf > " $_conf_file "
275+ _repo_config chaotic-aur " $tmp_dir /chaotic-mirrorlist" >> " $_conf_file "
252276
253- _blackarch_keyring_version () {
254- local _v
255- _v=$( _blackarch_keyring_files \
256- | awk -F/ ' {print $NF}' \
257- | sed -En ' s/^blackarch-keyring-([0-9]{8})\.tar\.gz(\.sig)?$/\1/p' \
258- | sort | tail -n1) || true
259- [[ -n " $_v " ]] || {
260- _msg_error " failed to determine blackarch keyring version"
261- return 1
262- }
263- printf ' %s\n' " $_v "
277+ # Install chaotic-keyring using the temporary config
278+ local _old_config_path=" $config_path "
279+ config_path=" $_conf_file "
280+ _pacman_S -y chaotic-keyring chaotic-mirrorlist
281+ config_path=" $_old_config_path "
264282}
265283
266- _archlinuxcn_install () {
267- if _has_repo " archlinuxcn" ; then
268- _msg_warn " archlinuxcn repository already exists in pacman configuration."
269- return 0
270- fi
271-
272- _archlinuxcn_install_keyring
273- _archlinuxcn_install_pkgs
274- _archlinuxcn_apppend_repo
284+ _blackarch_apppend_repo () {
285+ _repo_config blackarch " /etc/pacman.d/blackarch-mirrorlist" >> " $config_path "
275286}
276287
277288_archlinuxcn_apppend_repo () {
@@ -286,17 +297,6 @@ _chaotic_apppend_repo() {
286297 _repo_config chaotic-aur " /etc/pacman.d/chaotic-mirrorlist" >> " $config_path "
287298}
288299
289- _blackarch_keyring_latest_files () {
290- local _ver _urls
291- _ver=$( _blackarch_keyring_version) || return 1
292- _urls=$( _blackarch_keyring_files | grep " blackarch-keyring-${_ver} \.tar\.gz" ) || true
293- [[ -n " $_urls " ]] || {
294- _msg_error " failed to find keyring files for version $_ver "
295- return 1
296- }
297- printf ' %s\n' " $_urls "
298- }
299-
300300_blackarch_mirrorlist () {
301301 curl -fsSL " https://blackarch.org/blackarch-mirrorlist" # | sed 's/#Server/Server/'
302302}
0 commit comments