added selection of mirrors by country
Signed-off-by: Michael Picht <mipi@fsfe.org>
This commit is contained in:
parent
7bb766696c
commit
fc132433d4
1 changed files with 23 additions and 0 deletions
23
archfi
23
archfi
|
@ -725,6 +725,7 @@ installmenu(){
|
|||
nextitem=${1}
|
||||
fi
|
||||
options=()
|
||||
options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
|
||||
options+=("${txteditmirrorlist}" "(${txtoptional})")
|
||||
options+=("${txtinstallarchlinux}" "pacstrap base linux")
|
||||
options+=("${txtconfigarchlinux}" "")
|
||||
|
@ -733,6 +734,10 @@ installmenu(){
|
|||
3>&1 1>&2 2>&3)
|
||||
if [ "$?" = "0" ]; then
|
||||
case ${sel} in
|
||||
"${txtselectmirrorsbycountry}")
|
||||
selectmirrorsbycountry
|
||||
nextitem="${txtinstallarchlinux}"
|
||||
;;
|
||||
"${txteditmirrorlist}")
|
||||
${EDITOR} /etc/pacman.d/mirrorlist
|
||||
nextitem="${txtinstallarchlinux}"
|
||||
|
@ -752,6 +757,23 @@ installmenu(){
|
|||
fi
|
||||
}
|
||||
|
||||
selectmirrorsbycountry() {
|
||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
||||
items=$( sed -n "/^##.*/N; {s/^## \(.*\)\nServer.*/\1/p}" < /etc/pacman.d/mirrorlist.backup | sort -u )
|
||||
options=()
|
||||
IFS_ORIG=$IFS
|
||||
IFS=$'\n'
|
||||
for item in ${items}; do
|
||||
options+=("${item}" "")
|
||||
done
|
||||
IFS=$IFS_ORIG
|
||||
country=$(whiptail --backtitle "${APPTITLE}" --title "${txtselectcountry}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||
if [ "$?" != "0" ]; then
|
||||
return 1
|
||||
fi
|
||||
sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
|
||||
}
|
||||
|
||||
installbase(){
|
||||
clear
|
||||
echo "pacstrap /mnt base linux"
|
||||
|
@ -1719,6 +1741,7 @@ loadstrings(){
|
|||
|
||||
txtarchinstallmenu="Arch Install Menu"
|
||||
|
||||
txtselectmirrorsbycountry="Select mirrors by country"
|
||||
txteditmirrorlist="Edit mirrorlist"
|
||||
txtinstallarchlinux="Install Arch Linux"
|
||||
txtconfigarchlinux="Config Arch Linux"
|
||||
|
|
Loading…
Reference in a new issue