OSDN Git Service

add askmirrors
authorpaperbenni <paperbenni@gmail.com>
Wed, 10 Jun 2020 18:36:13 +0000 (20:36 +0200)
committerpaperbenni <paperbenni@gmail.com>
Wed, 10 Jun 2020 18:36:13 +0000 (20:36 +0200)
archinstall.sh
askutils.sh
depend/depend.sh
depend/system.sh
pacstrap/pacstrap.sh
topinstall.sh

index 95edd95..76b2cad 100755 (executable)
@@ -50,14 +50,7 @@ setinfo() {
 
 # sort mirrors
 pacman -Sy --noconfirm
-if command -v pacstrap; then
-    pacman -S reflector --noconfirm
-    echo "selecting fastest mirror"
-    reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
-fi
 
-# install dependencies
-pacman -Sy --noconfirm
 pacman -S git --noconfirm --needed
 
 cd /root
index b0f2587..b1aa9f7 100755 (executable)
@@ -136,6 +136,7 @@ askmirrors() {
     else
         echo "ranking mirrors"
         reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+        iroot automirror 1
     fi
 }
 
index f329a01..aabed51 100755 (executable)
@@ -45,11 +45,13 @@ while ! pacman -S --noconfirm --needed \
     echo "downloading packages failed, please reconnect to internet"
     sleep 10
 
-    # download new mirrors if on arch
-    if command -v reflector; then
-        reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
-    else
-        pacman-mirrors --geoip
+    if iroot automirror; then
+        # download new mirrors if on arch
+        if command -v reflector; then
+            reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+        else
+            pacman-mirrors --geoip
+        fi
     fi
     pacman -Sy --noconfirm
 
index a7371aa..4c06902 100755 (executable)
@@ -8,7 +8,9 @@ pacman -Sy --noconfirm
 
 while ! pacman -S xorg --noconfirm --needed; do
     dialog --msgbox "package installation failed \nplease reconnect to internet" 700 700
-    command -v reflector && --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+    iroot automirror && command -v reflector &&
+        reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+
 done
 
 while ! pacman -S --noconfirm --needed \
index d8d8e63..595eb41 100755 (executable)
@@ -19,7 +19,6 @@ else
     done
 fi
 
-
 if command -v genfstab; then
     genfstab -U /mnt >>/mnt/etc/fstab
 else
@@ -27,3 +26,4 @@ else
 fi
 cd /root
 cp -r ./instantARCH /mnt/root/instantARCH
+cat /etc/pacman.d/mirrorlist >/mnt/etc/pacman.d/mirrorlist
index 3349b57..af752ae 100755 (executable)
@@ -33,12 +33,7 @@ touch /opt/topinstall
 
 pacman -Sy --noconfirm
 
-if ! command -v mhwd; then
-    pacman -S reflector --noconfirm --needed
-    echo "selecting fastest mirror"
-    reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
-    pacman -Sy --noconfirm
-fi
+# todo: askmirrors
 
 pacman -S git --noconfirm --needed
 
@@ -57,6 +52,13 @@ mkdir config
 # do all actions requiring user input first
 ./topask.sh
 
+if ! command -v mhwd && iroot automirror; then
+    pacman -S reflector --noconfirm --needed
+    echo "selecting fastest mirror"
+    reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+    pacman -Sy --noconfirm
+fi
+
 ./init/init.sh
 
 pacman -S --noconfirm --needed base \