OSDN Git Service

b8410aa9047d376f9c287d756b705f36286747ab
[alterlinux/alterlinux-pkgbuilds.git] / update_aur.sh
1 #!/usr/bin/env bash
2
3 script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
4
5 set -eu
6
7 for DIR in $(find "${script_path}" -type f -name "PKGBUILD" | xargs realpath | xargs dirname); do
8     PACKAGE="$(basename "${DIR}")"
9     git clone "https://aur.archlinux.org/${PACKAGE}.git" "${script_path}/temp/${PACKAGE}"
10     if [[ -n "$(ls "${script_path}/temp/${PACKAGE}")" ]]; then
11         rm -rf "${DIR}"
12         mv "${script_path}/temp/${PACKAGE}" "${DIR}"
13         rm -rf "${DIR}/.git"
14     fi
15 done