OSDN Git Service

[update] : Supported official package
authorhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 12:04:58 +0000 (21:04 +0900)
committerhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 12:04:58 +0000 (21:04 +0900)
get_pkgbuild.sh [moved from get_from_aur.sh with 93% similarity]

similarity index 93%
rename from get_from_aur.sh
rename to get_pkgbuild.sh
index 7c68346..6d10ea5 100755 (executable)
@@ -274,7 +274,15 @@ for pkg in ${@}; do
             exit 1
         fi
     fi
-    mkdir -p "${script_path}/${repo}/${arch}/${pkg}"
-    git clone "https://aur.archlinux.org/${pkg}.git" "${script_path}/${repo}/${arch}/${pkg}"
+    if [[ ! "$(curl -sL "https://www.archlinux.org/packages/search/json/?name=${pkg}" | jq .results)" = "[]" ]]; then
+        mkdir -p "${script_path}/${repo}/${arch}/"
+        (
+            cd "${script_path}/${repo}/${arch}/"
+            asp export "${pkg}"
+        )
+    else
+        mkdir -p "${script_path}/${repo}/${arch}/${pkg}"
+        git clone "https://aur.archlinux.org/${pkg}.git" "${script_path}/${repo}/${arch}/${pkg}"
+    fi
     rm -rf "${script_path}/${repo}/${arch}/${pkg}/.git"
 done