OSDN Git Service

[add] : Added update script
authorhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 08:44:19 +0000 (17:44 +0900)
committerhayao <shun819.mail@gmail.com>
Sat, 12 Dec 2020 08:44:19 +0000 (17:44 +0900)
.gitignore
update_aur.sh [new file with mode: 0755]

index 9fcf0a9..52627ae 100644 (file)
@@ -12,3 +12,4 @@
 
 pkg/
 src/
+/temp
diff --git a/update_aur.sh b/update_aur.sh
new file mode 100755 (executable)
index 0000000..b8410aa
--- /dev/null
@@ -0,0 +1,15 @@
+#!/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