blob: 5b48b7fe0eb2be76fc7f341fcc60b896ed221a70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/sh
check_curl_installed() {
if ! command -v curl >/dev/null 2>&1; then
echo "error: curl is not installed :( please install curl to use curlpkg."
exit 1
fi
}
_base_url='https://aur.archlinux.org/cgit/aur.git/snapshot'
get_url_function() {
_pkg="$1"
_url="${_base_url}/${_pkg}.tar.gz"
echo "$_url"
}
run_curlpkg_function() {
_pkg="$(echo "$1" | tr -d '[:space:]')"
_url="$(get_url_function "$_pkg")"
curl -sSL "$_url" -o "${_pkg}.tar.gz"
}
curlpkg_function() {
for _pkg in "$@"; do
run_curlpkg_function "$_pkg" &
done
wait
}
usage_function() {
cat <<EOF
Usage:
curlpkg [-h|--help]
curlpkg <pkg> <pkg>...
Options:
-h, --help
print this help message
EOF
}
check_curl_installed
while [ $# -gt 0 ]; do
case "$1" in
-*)
usage_function
exit 0
;;
*)
curlpkg_function "$@"
exit 0
;;
esac
done
# vim: set filetype=sh foldmethod=marker foldlevel=0:
|