@@ -84,6 +84,17 @@ _arch4edu_install() {
8484 _arch4edu_apppend_repo
8585}
8686
87+ _chaotic_install () {
88+ if _has_repo " chaotic-aur" ; then
89+ _msg_warn " chaotic-aur repository already exists in pacman configuration."
90+ return 0
91+ fi
92+
93+ _chaotic_install_keyring
94+ _chaotic_install_pkgs
95+ _chaotic_apppend_repo
96+ }
97+
8798_blackarch_install_keyring () {
8899 local _url _version _tarfile=" blackarch_keyring-latest.tar.gz"
89100
@@ -152,6 +163,29 @@ _arch4edu_install_keyring() {
152163 _pacman_key --finger " $_key_id "
153164}
154165
166+ _chaotic_install_keyring () {
167+ local _key_id=" 3056513887B78AEB"
168+ _pacman_key --recv-keys " $_key_id " --keyserver keyserver.ubuntu.com
169+ _pacman_key --lsign-key " $_key_id "
170+ _pacman_key --finger " $_key_id "
171+ }
172+
173+ _chaotic_install_pkgs () {
174+ # Prepare chaotic-mirrorlist
175+ _chaotic_mirrorlist > " $tmp_dir /chaotic-mirrorlist"
176+
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 "
181+
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 "
187+ }
188+
155189_blackarch_install_pkgs () {
156190 # Prepare blackarch-mirrorlist
157191 _blackarch_mirrorlist > " $tmp_dir /blackarch-mirrorlist"
@@ -201,7 +235,7 @@ _arch4edu_install_pkgs() {
201235}
202236
203237_blackarch_apppend_repo () {
204- _repo_config blackarch " /etc/pacman.d/blackarch-mirrorlist" >> " /etc/pacman.conf "
238+ _repo_config blackarch " /etc/pacman.d/blackarch-mirrorlist" >> " $config_path "
205239}
206240
207241_blackarch_keyring_files () {
@@ -241,11 +275,15 @@ _archlinuxcn_install() {
241275}
242276
243277_archlinuxcn_apppend_repo () {
244- _repo_config archlinuxcn " /etc/pacman.d/archlinuxcn-mirrorlist" >> " /etc/pacman.conf "
278+ _repo_config archlinuxcn " /etc/pacman.d/archlinuxcn-mirrorlist" >> " $config_path "
245279}
246280
247281_arch4edu_apppend_repo () {
248- _repo_config arch4edu " /etc/pacman.d/mirrorlist.arch4edu" >> " /etc/pacman.conf"
282+ _repo_config arch4edu " /etc/pacman.d/mirrorlist.arch4edu" >> " $config_path "
283+ }
284+
285+ _chaotic_apppend_repo () {
286+ _repo_config chaotic-aur " /etc/pacman.d/chaotic-mirrorlist" >> " $config_path "
249287}
250288
251289_blackarch_keyring_latest_files () {
@@ -271,16 +309,20 @@ _arch4edu_mirrorlist() {
271309 curl -fsSL " https://raw.githubusercontent.com/arch4edu/mirrorlist/refs/heads/master/mirrorlist.arch4edu"
272310}
273311
312+ _chaotic_mirrorlist () {
313+ curl -fsSL " https://gitlab.com/chaotic-aur/pkgbuilds/-/raw/main/chaotic-mirrorlist/mirrorlist"
314+ }
315+
274316_init () {
275- # Parse flags: -c pacman_config, -r archlinuxcn|blackarch|arch4edu|all, -v, -q
317+ # Parse flags: -c pacman_config, -r archlinuxcn|blackarch|arch4edu|chaotic| all, -v, -q
276318 while getopts " :c:r:vq" opt; do
277319 case " $opt " in
278320 c)
279321 config_path=" $OPTARG "
280322 ;;
281323 r)
282324 case " $OPTARG " in
283- blackarch | archlinuxcn | arch4edu | all)
325+ blackarch | archlinuxcn | arch4edu | chaotic | all)
284326 target_repo=" $OPTARG "
285327 ;;
286328 * )
@@ -326,10 +368,14 @@ _main() {
326368 arch4edu)
327369 _arch4edu_install
328370 ;;
371+ chaotic)
372+ _chaotic_install
373+ ;;
329374 all)
330375 _arch4edu_install
331376 _blackarch_install
332377 _archlinuxcn_install
378+ _chaotic_install
333379 ;;
334380 esac
335381 cd " ${OLDPWD-.} " || exit 1
0 commit comments