From d49b0a9ca99f969d85015304ba50ae5bbbd7d9e7 Mon Sep 17 00:00:00 2001 From: hayao Date: Sat, 12 Dec 2020 21:15:36 +0900 Subject: [PATCH] [update] : Supported official package --- get_pkgbuild.sh | 2 +- update_aur.sh | 15 --------------- update_pkgbuilds.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 16 deletions(-) delete mode 100755 update_aur.sh create mode 100755 update_pkgbuilds.sh diff --git a/get_pkgbuild.sh b/get_pkgbuild.sh index 6d10ea5..7e8b98c 100755 --- a/get_pkgbuild.sh +++ b/get_pkgbuild.sh @@ -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 index b8410aa..0000000 --- a/update_aur.sh +++ /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 index 0000000..2c2ed69 --- /dev/null +++ b/update_pkgbuilds.sh @@ -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 -- 2.11.0