Merge pull request #198 from TessaiMusa/src

Reflector and parallel downloads support
This commit is contained in:
MatMoul 2022-10-15 01:08:53 +02:00 committed by GitHub
commit 636e6c81a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

59
archfi
View file

@ -739,6 +739,8 @@ installmenu(){
options=() options=()
#options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
options+=("${txteditmirrorlist}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})")
options+=("${txtfiltermirrorlist}" "reflector (${txtoptional})")
options+=("${txtparalleldownloads}" "(${txtoptional})")
options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtinstallarchlinux}" "pacstrap")
options+=("${txtconfigarchlinux}" "") options+=("${txtconfigarchlinux}" "")
sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \
@ -754,6 +756,14 @@ installmenu(){
${EDITOR} /etc/pacman.d/mirrorlist ${EDITOR} /etc/pacman.d/mirrorlist
nextitem="${txtinstallarchlinux}" nextitem="${txtinstallarchlinux}"
;; ;;
"${txtfiltermirrorlist}")
filtermirrorlist
nextitem="${txtparalleldownloads}"
;;
"${txtparalleldownloads}")
paralleldownloads
nextitem="${txtinstallarchlinuk}"
;;
"${txtinstallarchlinux}") "${txtinstallarchlinux}")
if(installbase) then if(installbase) then
nextitem="${txtconfigarchlinux}" nextitem="${txtconfigarchlinux}"
@ -789,6 +799,47 @@ selectmirrorsbycountry() {
sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
} }
filtermirrorlist() {
command -v reflector > /dev/null || {
echo "pacman -S --noconfirm reflector"
pacman -S --noconfirm reflector
}
options=()
options+=("${txtfiltermirrorlist}" "")
options+=("${txtedit//%1/reflector.conf}" "")
sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtback}" --default-item "Filter mirrorlist" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
case ${sel} in
"${txtfiltermirrorlist}")
clear
echo "systemctl start reflector.service"
systemctl start reflector.service
pressanykey
;;
"${txtedit//%1/reflector.conf}")
${EDITOR} /etc/xdg/reflector/reflector.conf
filtermirrorlist
;;
esac
}
paralleldownloads() {
numpkg=$(whiptail --backtitle "${apptitle}" --title "${txtparallelprompt}" --inputbox "" 0 0 "5" 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
if [[ "$numpkg" =~ ^[1-9][0-9]*$ ]] ; then
sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /etc/pacman.conf
else
clear
unset numpkg
echo ${txtincorrectinput}
pressanykey
fi
fi
}
installbase(){ installbase(){
pkgs="base" pkgs="base"
options=() options=()
@ -881,6 +932,9 @@ installbase(){
clear clear
echo "pacstrap /mnt ${pkgs}" echo "pacstrap /mnt ${pkgs}"
pacstrap /mnt ${pkgs} pacstrap /mnt ${pkgs}
if [ ! -z $numpkg ]; then
sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /mnt/etc/pacman.conf
fi
pressanykey pressanykey
} }
@ -1893,6 +1947,8 @@ loadstrings(){
txtselectmirrorsbycountry="Select mirrors by country" txtselectmirrorsbycountry="Select mirrors by country"
txtselectcountry="Select country" txtselectcountry="Select country"
txteditmirrorlist="Edit mirrorlist" txteditmirrorlist="Edit mirrorlist"
txtfiltermirrorlist="Filter mirrorlist"
txtparalleldownloads="Parallel Downloads"
txtinstallarchlinux="Install Arch Linux" txtinstallarchlinux="Install Arch Linux"
txtinstallarchlinuxkernel="Kernel" txtinstallarchlinuxkernel="Kernel"
txtinstallarchlinuxfirmwares="Firmwares" txtinstallarchlinuxfirmwares="Firmwares"
@ -1900,6 +1956,9 @@ loadstrings(){
txtinstallarchlinuxcustompackagelist="Custom Package List" txtinstallarchlinuxcustompackagelist="Custom Package List"
txtconfigarchlinux="Config Arch Linux" txtconfigarchlinux="Config Arch Linux"
txtparallelprompt="Number of packages to download in Parallel"
txtincorrectinput="Please enter a number greater than 0"
txtsethostname="Set Computer Name" txtsethostname="Set Computer Name"
txtsetfont="Set Font" txtsetfont="Set Font"
txtsetlocale="Set Locale" txtsetlocale="Set Locale"