2 files changed, 68 insertions, 5 deletions
|
diff --git a/README b/README index 63773e4..a76e59e 100644 --- a/ README+++ b/ README |
| @@ -1,14 +1,17 @@ |
| 1 | gitpkg |
1 | gitpkg/gitaur |
| 2 | ------ |
2 | ------ |
| 3 | |
3 | |
| 4 | simple POSIX helper script that grabs the PKGBUILD of Arch Linux packages (in |
4 | simple POSIX helper scripts that grabs the PKGBUILD of Arch Linux packages via |
| 5 | the official repos) via `git`. |
5 | `git`. |
| |
6 | |
| |
7 | gitpkg = grabs PKGBUILDs from the Official Arch Repositories |
| |
8 | gitaur = grabs PKGBUILDs from the Arch User Repository |
| 6 | |
9 | |
| 7 | ------ |
10 | ------ |
| 8 | |
11 | |
| 9 | usage: |
12 | usage: |
| 10 | gitpkg [-h|--help] |
13 | $0 [-h|--help] |
| 11 | gitpkg <package name> <package name>... |
14 | $0 <package name> <package name>... |
| 12 | |
15 | |
| 13 | options: |
16 | options: |
| 14 | -h, --help |
17 | -h, --help |
|
|
diff --git a/gitaur b/gitaur new file mode 100755 index 0000000..9c8bffe --- /dev/null +++ b/ gitaur |
| @@ -0,0 +1,60 @@ |
| |
1 | #!/bin/sh |
| |
2 | |
| |
3 | check_git_installed() { |
| |
4 | if ! command -v git >/dev/null 2>&1; then |
| |
5 | echo "error: git is not installed :( please git wget to use $0." |
| |
6 | exit 1 |
| |
7 | fi |
| |
8 | } |
| |
9 | |
| |
10 | _base_url='https://aur.archlinux.org' |
| |
11 | |
| |
12 | get_url_function() { |
| |
13 | _pkg="$1" |
| |
14 | _url="${_base_url}/${_pkg}.git" |
| |
15 | |
| |
16 | echo "$_url" |
| |
17 | } |
| |
18 | |
| |
19 | run_grabber_function() { |
| |
20 | _pkg="$(echo "$1" | tr -d '[:space:]')" |
| |
21 | _url="$(get_url_function "$_pkg")" |
| |
22 | |
| |
23 | git clone "$_url" |
| |
24 | } |
| |
25 | |
| |
26 | grabber_function() { |
| |
27 | for _pkg in "$@"; do |
| |
28 | run_grabber_function "$_pkg" & |
| |
29 | done |
| |
30 | wait |
| |
31 | } |
| |
32 | |
| |
33 | usage_function() { |
| |
34 | cat <<EOF |
| |
35 | usage: |
| |
36 | $0 [-h|--help] |
| |
37 | $0 <pkg> <pkg>... |
| |
38 | |
| |
39 | options: |
| |
40 | -h, --help |
| |
41 | print this help message |
| |
42 | EOF |
| |
43 | } |
| |
44 | |
| |
45 | check_git_installed |
| |
46 | |
| |
47 | while [ $# -gt 0 ]; do |
| |
48 | case "$1" in |
| |
49 | -*) |
| |
50 | usage_function |
| |
51 | exit 0 |
| |
52 | ;; |
| |
53 | *) |
| |
54 | grabber_function "$@" |
| |
55 | exit 0 |
| |
56 | ;; |
| |
57 | esac |
| |
58 | done |
| |
59 | |
| |
60 | # vim: set filetype=sh foldmethod=marker foldlevel=0: |
|