OSDN Git Service

[update] : Supported official package
authorhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 12:15:36 +0000 (21:15 +0900)
committerhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 12:15:36 +0000 (21:15 +0900)
get_pkgbuild.sh
update_aur.sh [deleted file]
update_pkgbuilds.sh [new file with mode: 0755]

index 6d10ea5..7e8b98c 100755 (executable)
@@ -283,6 +283,6 @@ for pkg in ${@}; do
     else
         mkdir -p "${script_path}/${repo}/${arch}/${pkg}"
         git clone "https://aur.archlinux.org/${pkg}.git" "${script_path}/${repo}/${arch}/${pkg}"
+        rm -rf "${script_path}/${repo}/${arch}/${pkg}/.git"
     fi
-    rm -rf "${script_path}/${repo}/${arch}/${pkg}/.git"
 done
diff --git a/update_aur.sh b/update_aur.sh
deleted file mode 100755 (executable)
index b8410aa..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
-
-set -eu
-
-for DIR in $(find "${script_path}" -type f -name "PKGBUILD" | xargs realpath | xargs dirname); do
-    PACKAGE="$(basename "${DIR}")"
-    git clone "https://aur.archlinux.org/${PACKAGE}.git" "${script_path}/temp/${PACKAGE}"
-    if [[ -n "$(ls "${script_path}/temp/${PACKAGE}")" ]]; then
-        rm -rf "${DIR}"
-        mv "${script_path}/temp/${PACKAGE}" "${DIR}"
-        rm -rf "${DIR}/.git"
-    fi
-done
diff --git a/update_pkgbuilds.sh b/update_pkgbuilds.sh
new file mode 100755 (executable)
index 0000000..2c2ed69
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
+
+set -eu
+
+for DIR in $(find "${script_path}" -type f -name "PKGBUILD" | xargs realpath | xargs dirname); do
+    PACKAGE="$(basename "${DIR}")"
+
+    if [[ "${PACKAGE}" = "filesystem" ]]; then
+        continue
+    fi
+
+    if [[ ! "$(curl -sL "https://www.archlinux.org/packages/search/json/?name=${PACKAGE}" | jq .results)" = "[]" ]]; then
+        mkdir -p "${DIR}"
+        (
+            cd "${DIR}/../"
+            rm -rf "${PACKAGE}"
+            asp export "${PACKAGE}"
+        )
+    else
+        mkdir -p "${script_path}/temp/${PACKAGE}"
+        git clone "https://aur.archlinux.org/${PACKAGE}.git" "${script_path}/temp/${PACKAGE}"
+        if [[ -n "$(ls "${script_path}/temp/${PACKAGE}")" ]]; then
+            rm -rf "${DIR}"
+            mv "${script_path}/temp/${PACKAGE}" "${DIR}"
+            rm -rf "${DIR}/.git"
+        fi
+    fi
+done