Changed to variables and moved parallel downloads to new function

This commit is contained in:
TessaiMusa 2021-10-21 09:47:30 +05:30
parent d2237ae73c
commit c0d3ea0a72

44
archfi
View file

@ -739,8 +739,8 @@ installmenu(){
options=() options=()
#options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
options+=("${txteditmirrorlist}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})")
options+=("${txtfiltermirrorlist}" "reflector") options+=("${txtfiltermirrorlist}" "reflector (${txtoptional})")
options+=("Parallel downloads of packages" "(${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 \
@ -758,26 +758,17 @@ installmenu(){
;; ;;
"${txtfiltermirrorlist}") "${txtfiltermirrorlist}")
filtermirrorlist filtermirrorlist
nextitem="${txtinstallarchlinux}" nextitem="${txtparalleldownloads}"
;;
"${txtparalleldownloads}")
paralleldownloads
nextitem="${txtinstallarchlinuk}"
;; ;;
"${txtinstallarchlinux}") "${txtinstallarchlinux}")
if(installbase) then if(installbase) then
nextitem="${txtconfigarchlinux}" nextitem="${txtconfigarchlinux}"
fi fi
;; ;;
"Parallel downloads of packages")
numpkg=$(whiptail --backtitle "${apptitle}" --title "Number of packages to download at once" --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
echo 'Please enter number greater 0'
pressanykey
fi
fi
;;
"${txtconfigarchlinux}") "${txtconfigarchlinux}")
archmenu archmenu
nextitem="${txtconfigarchlinux}" nextitem="${txtconfigarchlinux}"
@ -814,7 +805,7 @@ filtermirrorlist() {
pacman -S --noconfirm reflector pacman -S --noconfirm reflector
} }
options=() options=()
options+=("Filter mirrorlist" "") options+=("${txtfiltermirrorlist}" "")
options+=("${txtedit//%1/reflector.conf}" "") options+=("${txtedit//%1/reflector.conf}" "")
sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtback}" --default-item "Filter mirrorlist" 0 0 0 \ sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtback}" --default-item "Filter mirrorlist" 0 0 0 \
"${options[@]}" \ "${options[@]}" \
@ -833,6 +824,21 @@ filtermirrorlist() {
esac 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
echo ${txtincorrectinput}
pressanykey
fi
fi
}
installbase(){ installbase(){
pkgs="base" pkgs="base"
options=() options=()
@ -1938,6 +1944,7 @@ loadstrings(){
txtselectcountry="Select country" txtselectcountry="Select country"
txteditmirrorlist="Edit mirrorlist" txteditmirrorlist="Edit mirrorlist"
txtfiltermirrorlist="Filter mirrorlist" txtfiltermirrorlist="Filter mirrorlist"
txtparalleldownloads="Parallel Downloads"
txtinstallarchlinux="Install Arch Linux" txtinstallarchlinux="Install Arch Linux"
txtinstallarchlinuxkernel="Kernel" txtinstallarchlinuxkernel="Kernel"
txtinstallarchlinuxfirmwares="Firmwares" txtinstallarchlinuxfirmwares="Firmwares"
@ -1945,6 +1952,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"