From d16fe3b9ef4133880f99d682f7c67eb20ec6f2c5 Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Wed, 20 Oct 2021 20:20:54 +0530 Subject: [PATCH 1/8] Reflector support --- archfi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/archfi b/archfi index 1db8ca6..48ae2d0 100644 --- a/archfi +++ b/archfi @@ -739,6 +739,7 @@ installmenu(){ options=() #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") + options+=("Filter mirrorlist" "Reflector") options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ @@ -754,6 +755,10 @@ installmenu(){ ${EDITOR} /etc/pacman.d/mirrorlist nextitem="${txtinstallarchlinux}" ;; + "Filter mirrorlist") + rankmirrorlist + nextitem="${txtinstallarchlinux}" + ;; "${txtinstallarchlinux}") if(installbase) then nextitem="${txtconfigarchlinux}" @@ -789,6 +794,29 @@ selectmirrorsbycountry() { sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist } +rankmirrorlist() { + command -v reflector > /dev/null || { + echo "pacman -S --noconfirm reflector" + pacman -S --noconfirm reflector + } + options=() + options+=("Filter mirrorlist") + options+=("Edit /etc/xdg/reflector/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 + "Filter mirrorlist") + echo "systemctl start reflector.service" + systemctl start reflector.service + pressanykey + ;; + "Edit /etc/xdg/reflector/reflector.conf") + ${EDITOR} /etc/xdg/reflector/reflector.conf + ;; + esac +} + installbase(){ pkgs="base" options=() From d169270f5856992c671f9ba3f39ca94d3542b54e Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Wed, 20 Oct 2021 20:27:59 +0530 Subject: [PATCH 2/8] Fixed menu issue --- archfi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archfi b/archfi index 48ae2d0..3968e19 100644 --- a/archfi +++ b/archfi @@ -800,8 +800,8 @@ rankmirrorlist() { pacman -S --noconfirm reflector } options=() - options+=("Filter mirrorlist") - options+=("Edit /etc/xdg/reflector/reflector.conf") + options+=("Filter mirrorlist" "") + options+=("Edit /etc/xdg/reflector/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) From 04ec79a37e95876e7e1ea270730e4e46515e5f0c Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Wed, 20 Oct 2021 20:48:21 +0530 Subject: [PATCH 3/8] changed from strings to vars and fixed some more issues --- archfi | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/archfi b/archfi index 3968e19..4a28830 100644 --- a/archfi +++ b/archfi @@ -739,7 +739,7 @@ installmenu(){ options=() #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") - options+=("Filter mirrorlist" "Reflector") + options+=("${txtfiltermirrorlist}" "reflector") options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ @@ -755,8 +755,8 @@ installmenu(){ ${EDITOR} /etc/pacman.d/mirrorlist nextitem="${txtinstallarchlinux}" ;; - "Filter mirrorlist") - rankmirrorlist + "${txtfiltermirrorlist}") + filtermirrorlist nextitem="${txtinstallarchlinux}" ;; "${txtinstallarchlinux}") @@ -794,25 +794,27 @@ selectmirrorsbycountry() { sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist } -rankmirrorlist() { +filtermirrorlist() { command -v reflector > /dev/null || { echo "pacman -S --noconfirm reflector" pacman -S --noconfirm reflector } options=() options+=("Filter mirrorlist" "") - options+=("Edit /etc/xdg/reflector/reflector.conf" "") + 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 - "Filter mirrorlist") + "${txtfiltermirrorlist}") + clear echo "systemctl start reflector.service" systemctl start reflector.service pressanykey ;; - "Edit /etc/xdg/reflector/reflector.conf") + "${txtedit//%1/reflector.conf}") ${EDITOR} /etc/xdg/reflector/reflector.conf + filtermirrorlist ;; esac } @@ -1921,6 +1923,7 @@ loadstrings(){ txtselectmirrorsbycountry="Select mirrors by country" txtselectcountry="Select country" txteditmirrorlist="Edit mirrorlist" + txtfiltermirrorlist="Filter mirrorlist" txtinstallarchlinux="Install Arch Linux" txtinstallarchlinuxkernel="Kernel" txtinstallarchlinuxfirmwares="Firmwares" From f8ec8488eda7f5cae108d7149c7523ce8fb28435 Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Wed, 20 Oct 2021 21:22:30 +0530 Subject: [PATCH 4/8] Added parallel download support --- archfi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/archfi b/archfi index 4a28830..dc9db48 100644 --- a/archfi +++ b/archfi @@ -740,6 +740,7 @@ installmenu(){ #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") options+=("${txtfiltermirrorlist}" "reflector") + outputs+=("Parallel downloads of packages" "") options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ @@ -764,6 +765,17 @@ installmenu(){ nextitem="${txtconfigarchlinux}" fi ;; + "Parallel downloads of packages") + numpkg=$(whiptail --backtitle "${apptitle}" --title "Number of packages to download at once" --inputbox "" 0 0 "archlinux" 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + if [[ "$numpkg" =~ '^[1-9][0-9]*$' ]] ; then + echo "ParallelDownloads = ${numpkg}" >> /etc/pacman.conf + else + echo 'Please enter number greater 0' + pressanykey + fi + fi + ;; "${txtconfigarchlinux}") archmenu nextitem="${txtconfigarchlinux}" From 7f1b9c3aab4177ee19626dcac83af72d796b3cdf Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Wed, 20 Oct 2021 22:07:04 +0530 Subject: [PATCH 5/8] Fixed critical bugs --- archfi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/archfi b/archfi index dc9db48..e8089ff 100644 --- a/archfi +++ b/archfi @@ -740,7 +740,7 @@ installmenu(){ #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") options+=("${txtfiltermirrorlist}" "reflector") - outputs+=("Parallel downloads of packages" "") + options+=("Parallel downloads of packages" "(${txtoptional})") options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ @@ -766,10 +766,10 @@ installmenu(){ fi ;; "Parallel downloads of packages") - numpkg=$(whiptail --backtitle "${apptitle}" --title "Number of packages to download at once" --inputbox "" 0 0 "archlinux" 3>&1 1>&2 2>&3) + 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 - echo "ParallelDownloads = ${numpkg}" >> /etc/pacman.conf + if [[ "$numpkg" =~ ^[1-9][0-9]*$ ]] ; then + sed -i "'s/ParallelDownloads/ParallelDownloads = ' ${numpkg}" >> /etc/pacman.conf else echo 'Please enter number greater 0' pressanykey From d2237ae73c5b4ba9a499dfd73e9a088a56b5f33a Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Thu, 21 Oct 2021 09:17:05 +0530 Subject: [PATCH 6/8] Fixed more bugs --- archfi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archfi b/archfi index e8089ff..f224970 100644 --- a/archfi +++ b/archfi @@ -769,8 +769,10 @@ installmenu(){ 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 + sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /etc/pacman.conf + else + clear echo 'Please enter number greater 0' pressanykey fi From c0d3ea0a72f94a210d39145b3cf3704bc3c1732b Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Thu, 21 Oct 2021 09:47:30 +0530 Subject: [PATCH 7/8] Changed to variables and moved parallel downloads to new function --- archfi | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/archfi b/archfi index f224970..34196ce 100644 --- a/archfi +++ b/archfi @@ -739,8 +739,8 @@ installmenu(){ options=() #options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") - options+=("${txtfiltermirrorlist}" "reflector") - options+=("Parallel downloads of packages" "(${txtoptional})") + options+=("${txtfiltermirrorlist}" "reflector (${txtoptional})") + options+=("${txtparalleldownloads}" "(${txtoptional})") options+=("${txtinstallarchlinux}" "pacstrap") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ @@ -758,26 +758,17 @@ installmenu(){ ;; "${txtfiltermirrorlist}") filtermirrorlist - nextitem="${txtinstallarchlinux}" + nextitem="${txtparalleldownloads}" + ;; + "${txtparalleldownloads}") + paralleldownloads + nextitem="${txtinstallarchlinuk}" ;; "${txtinstallarchlinux}") if(installbase) then nextitem="${txtconfigarchlinux}" 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}") archmenu nextitem="${txtconfigarchlinux}" @@ -814,7 +805,7 @@ filtermirrorlist() { pacman -S --noconfirm reflector } options=() - options+=("Filter mirrorlist" "") + 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[@]}" \ @@ -833,6 +824,21 @@ 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 + echo ${txtincorrectinput} + pressanykey + fi + fi + + +} + installbase(){ pkgs="base" options=() @@ -1938,12 +1944,16 @@ loadstrings(){ txtselectcountry="Select country" txteditmirrorlist="Edit mirrorlist" txtfiltermirrorlist="Filter mirrorlist" + txtparalleldownloads="Parallel Downloads" txtinstallarchlinux="Install Arch Linux" txtinstallarchlinuxkernel="Kernel" txtinstallarchlinuxfirmwares="Firmwares" txtinstallarchlinuxfilesystems="File Systems" txtinstallarchlinuxcustompackagelist="Custom Package List" txtconfigarchlinux="Config Arch Linux" + + txtparallelprompt="Number of packages to download in Parallel" + txtincorrectinput="Please enter a number greater than 0" txtsethostname="Set Computer Name" txtsetfont="Set Font" From 02e85750b5ad0adb238e936c32a88eedb15c419c Mon Sep 17 00:00:00 2001 From: TessaiMusa <49408514+TessaiMusa@users.noreply.github.com> Date: Sat, 13 Nov 2021 18:38:11 +0530 Subject: [PATCH 8/8] ParallelDownloads now apply to installed system --- archfi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archfi b/archfi index 34196ce..7213f2a 100644 --- a/archfi +++ b/archfi @@ -831,6 +831,7 @@ paralleldownloads() { sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /etc/pacman.conf else clear + unset numpkg echo ${txtincorrectinput} pressanykey fi @@ -931,6 +932,9 @@ installbase(){ clear echo "pacstrap /mnt ${pkgs}" pacstrap /mnt ${pkgs} + if [ ! -z $numpkg ]; then + sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /mnt/etc/pacman.conf + fi pressanykey }