blob: d1738c84f7be12e408d8a8b27d07a4b9aefc20fd (
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_wget_installed() {
if ! command -v wget >/dev/null 2>&1; then
echo "error: wget is not installed :( please install wget to use wgetpkg."
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_wgetpkg_function() {
_pkg="$(echo "$1" | tr -d '[:space:]')"
_url="$(get_url_function "$_pkg")"
wget --no-verbose "$_url"
}
wgetpkg_function() {
for _pkg in "$@"; do
run_wgetpkg_function "$_pkg" &
done
wait
}
usage_function() {
cat <<EOF
Usage:
wgetpkg [-h|--help]
wgetpkg <pkg> <pkg>...
Options:
-h, --help
print this help message
EOF
}
check_wget_installed
while [ $# -gt 0 ]; do
case "$1" in
-*)
usage_function
exit 0
;;
*)
wgetpkg_function "$@"
exit 0
;;
esac
done
# vim: set filetype=sh foldmethod=marker foldlevel=0:
|