i understand and use cachyos-rate-mirrors to update /etc/pacman.d/cachyos-mirrorlist.
but i prefer the granularity of the reflector command, and use with other arch installs.
if one wanted to completely omit using cachtyos-rate-mirrors and use only reflector in order to have pacman -Syu update using the reflector generated lists, how would one go about that?
pacman.conf has v3, v4 and cachyos all being determined from cachyos-mirrorlist, which seems to only have the mirrors set by cachyos-rate-mirrors command which is run by cachyos-rate-mirrors.timer
whats the work around? RN i have a hybrid update file that uses a modified cachyos-rate-mirrors script that does not rate-mirror the arch repos, only setting mirrors for cachyos-mirrorlist and uses reflector to update the arch reposâŚworks fine, but seems heavy.
#!/bin/bash
# Colors
bold_cyan="\e[1;36m"
bold_white="\e[1;37m"
reset="\e[0m"
echo -e "${bold_cyan}:: ${bold_white}Starting Rate-mirrors...${reset}"
sudo cachyos-rate-mirrors
# Path to the timestamp file
timestamp_file="$HOME/reflector_timestamp"
# Current time in seconds since epoch
current_time=$(date +%s)
# Check if the file exists
if [[ -f "$timestamp_file" ]]; then
# Get the last modified time of the timestamp file
file_mod_time=$(stat -c %Y "$timestamp_file")
# Compute the age of the file
file_age=$((current_time - file_mod_time))
# Check if the file age is less than 12 hours (43200 seconds)
if [[ $file_age -lt 43200 ]]; then
echo -e "${bold_cyan}:: ${bold_white}Reflector mirrors < 12hr old...${reset}"
cat /etc/pacman.d/mirrorlist
echo -e "${bold_cyan}==> ${bold_white}Starting pacman -Syu...${reset}"
sudo pacman -Syu --noconfirm
echo -e "${bold_cyan}[Done]${reset}"
exit 0
else
echo -e "${bold_cyan}:: ${bold_white}Reflector mirrors old...${reset}"
echo -e "${bold_cyan}==> ${bold_white}Starting Reflector...${reset}"
sudo reflector --verbose -c CA -c MX -c US --protocol https --sort rate --latest 10 --download-timeout 5 --save /etc/pacman.d/mirrorlist
echo -e "${bold_cyan}:: ${bold_white}Selected Servers:${reset}"
cat /etc/pacman.d/mirrorlist
echo -e "${bold_cyan}==> ${bold_white}Starting pacman -Syu...${reset}"
sudo pacman -Syu --noconfirm
fi
else
echo -e "${bold_cyan}:: ${bold_white}Timestamp file does not exist...${reset}"
echo -e "${bold_cyan}==> ${bold_white}Starting Reflector...${reset}"
sudo reflector --verbose -c CA -c MX -c US --protocol https --sort rate --latest 10 --download-timeout 5 --save /etc/pacman.d/mirrorlist
echo -e "${bold_cyan}:: ${bold_white}Selected Servers:${reset}"
cat /etc/pacman.d/mirrorlist
echo -e "${bold_cyan}==> ${bold_white}Starting pacman -Syu...${reset}"
sudo pacman -Syu --noconfirm
# Create the timestamp file
echo -e "${bold_cyan}==> ${bold_white}Saving timestamp file...${reset}"
touch "$timestamp_file"
echo -e "${bold_cyan}[Done]${reset}"
exit 0
fi
# Update the timestamp file with the current time
echo -e "${bold_cyan}==> Updating timestamp file now...${reset}"
touch "$timestamp_file"
echo -e "${bold_cyan}[Done]${reset}"