Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
aa8929ff8e | |||
2ab2fdd126 | |||
2c37b9e64e | |||
59432612de | |||
61a9cbd34d |
@@ -7,6 +7,11 @@ A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
|
|||||||
Flags:
|
Flags:
|
||||||
-h Show this message.
|
-h Show this message.
|
||||||
-s Search for <package>.
|
-s Search for <package>.
|
||||||
|
-S Search only in the sync db. Implies -s.
|
||||||
|
-A Search only in AUR. Implies -s.
|
||||||
-d Get the package sources (default).
|
-d Get the package sources (default).
|
||||||
|
-D Get the dependencies also. Implies -d.
|
||||||
|
|
||||||
You can override any value in the script in \$HOME/.config/zpac.rc.sh
|
You can override any value in the script in \$HOME/.config/zpac.rc.sh
|
||||||
|
By default zpac downloads the sources into the current directory. Controlled by `$cfg_workdir`.
|
||||||
|
|
||||||
|
45
zpac
45
zpac
@@ -18,8 +18,10 @@ usage() {
|
|||||||
Flags:
|
Flags:
|
||||||
-h Show this message.
|
-h Show this message.
|
||||||
-s Search for <package>.
|
-s Search for <package>.
|
||||||
|
-S Search only in the sync db. Implies -s.
|
||||||
|
-A Search only in AUR. Implies -s.
|
||||||
-d Get the package sources (default).
|
-d Get the package sources (default).
|
||||||
-D If used with -d, makes $_self download the dependencies from AUR too.
|
-D Get the dependencies also. Implies -d.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +86,7 @@ aur.get() {
|
|||||||
aur_deps_count=$( jshon -e resultcount <<< "$aur_deps_api_data" )
|
aur_deps_count=$( jshon -e resultcount <<< "$aur_deps_api_data" )
|
||||||
|
|
||||||
if (( aur_deps_count )); then
|
if (( aur_deps_count )); then
|
||||||
aur_deps=$( jshon -e results -a -e Name -u <<< "$aur_deps_api_data" )
|
aur_deps=( $( jshon -e results -a -e Name -u <<< "$aur_deps_api_data" ) )
|
||||||
|
|
||||||
for i in "${aur_deps[@]}"; do
|
for i in "${aur_deps[@]}"; do
|
||||||
aur.get < <(aur.info "$i") || {
|
aur.get < <(aur.info "$i") || {
|
||||||
@@ -117,14 +119,23 @@ main() {
|
|||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--help|-h) usage; return 0;;
|
(-h) usage; return 0;;
|
||||||
|
|
||||||
-s) action='search';;
|
(-s) action='search';;
|
||||||
-d) action='get';;
|
(-A)
|
||||||
-D) flag_get_deps=1;;
|
action='search'
|
||||||
|
flag_search_aur=1;;
|
||||||
|
(-S)
|
||||||
|
action='search'
|
||||||
|
flag_search_syncdb=1;;
|
||||||
|
|
||||||
--) shift; break;;
|
(-d) action='get';;
|
||||||
-*)
|
(-D)
|
||||||
|
action='get'
|
||||||
|
flag_get_deps=1;;
|
||||||
|
|
||||||
|
(--) shift; break;;
|
||||||
|
(-*)
|
||||||
err "Unknown key: $1"
|
err "Unknown key: $1"
|
||||||
usage
|
usage
|
||||||
return 1
|
return 1
|
||||||
@@ -135,7 +146,14 @@ main() {
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
action=${action:-"get"}
|
(( flag_search_aur && flag_search_syncdb )) && {
|
||||||
|
unset flag_search_aur flag_search_syncdb
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$action" ]] || {
|
||||||
|
usage
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "$1" ]]; then
|
if [[ "$1" ]]; then
|
||||||
package="$1"
|
package="$1"
|
||||||
@@ -186,8 +204,13 @@ main() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
(search)
|
(search)
|
||||||
if type -P package-query &>/dev/null; then
|
if (( flag_search_aur )); then
|
||||||
package-query -ASs "$package"
|
aur.search "$package" || {
|
||||||
|
err "No packages found."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
elif (( flag_search_syncdb )); then
|
||||||
|
pacman -Ss "$package"
|
||||||
else
|
else
|
||||||
aur.search "$package" || { flag_aur_search_fail=1; }
|
aur.search "$package" || { flag_aur_search_fail=1; }
|
||||||
pacman -Ss "$package" 2>/dev/null || { flag_pacman_search_fail=1; }
|
pacman -Ss "$package" 2>/dev/null || { flag_pacman_search_fail=1; }
|
||||||
|
Reference in New Issue
Block a user