OSDN Git Service

rework repo.sh
authorpaperbenni <paperbenni@gmail.com>
Thu, 16 Jul 2020 12:24:07 +0000 (14:24 +0200)
committerpaperbenni <paperbenni@gmail.com>
Thu, 16 Jul 2020 12:24:07 +0000 (14:24 +0200)
programs/instantsudo
repo.sh

index a431548..f9ed17d 100755 (executable)
@@ -4,4 +4,4 @@
 SUDO_ASKPASS="$(which instantpassword)"
 export SUDO_ASKPASS
 export PASSPROMPT="sudo password for $USER"
-sudo -A "$@"
+sudo -A $@
diff --git a/repo.sh b/repo.sh
index 4235393..3bc5228 100755 (executable)
--- a/repo.sh
+++ b/repo.sh
@@ -6,20 +6,25 @@
 
 echo "adding instantOS repo"
 
-if ! uname -m | grep -q '^i'; then
-    # default is 64 bit repo
-    if ! grep -q 'instantos\.surge\.sh' /etc/pacman.conf; then
+addrepo() {
+    if ! grep -q "$1"'\.surge\.sh' /etc/pacman.conf; then
+        echo "adding $1 repo"
         echo "[instant]" >>/etc/pacman.conf
         echo "SigLevel = Optional TrustAll" >>/etc/pacman.conf
-        echo "Server = http://instantos.surge.sh" >>/etc/pacman.conf
+        echo "Server = http://$1.surge.sh" >>/etc/pacman.conf
     else
-        echo "instantOS repository already added"
+        echo "instantOS $1 repository already added"
     fi
+
+}
+
+if uname -m | grep -q '^x'; then
+    # default is 64 bit repo
+    addrepo instantos
+elif uname -m | grep 'arm'; then
+    addrepo instantosarm
+elif uname -m | grep '^i'; then
+    addrepo instantos32
 else
-    # 32 bit has a seperate repo (obviously)
-    if ! grep -q 'instantos\.surge\.sh' /etc/pacman.conf; then
-        echo "[instant]" >>/etc/pacman.conf
-        echo "SigLevel = Optional TrustAll" >>/etc/pacman.conf
-        echo "Server = http://instantos32.surge.sh" >>/etc/pacman.conf
-    fi
+    echo "no suitable repo for architecture found"
 fi