Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8591081269 | |||
9e15b8200e | |||
bf18623e06 |
19
README.md
19
README.md
@@ -2,16 +2,15 @@ zpac
|
|||||||
----
|
----
|
||||||
A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
|
A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
|
||||||
|
|
||||||
$ zpac -h
|
Usage: zpac [flags] <package>
|
||||||
Usage: zpac [flags] <package>
|
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.
|
||||||
-S Search only in the sync db. Implies -s.
|
-A Search only in AUR. Implies -s.
|
||||||
-A Search only in AUR. Implies -s.
|
-d Get the package sources (default). Set twice to also get the dependencies.
|
||||||
-d Get the package sources (default).
|
-f Force downloading package sources even if they are already present in the working directory.
|
||||||
-D Get the dependencies also. Implies -d.
|
-w <dir> Set the working directory.
|
||||||
|
|
||||||
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`.
|
By default zpac downloads the sources into the current directory. Controlled by `$cfg_workdir`.
|
||||||
|
|
||||||
|
105
zpac
105
zpac
@@ -23,10 +23,6 @@ usage() {
|
|||||||
-d Get the package sources (default). Set twice to also get the dependencies.
|
-d Get the package sources (default). Set twice to also get the dependencies.
|
||||||
-f Force downloading package sources even if they are already present in the working directory.
|
-f Force downloading package sources even if they are already present in the working directory.
|
||||||
-w <dir> Set the working directory.
|
-w <dir> Set the working directory.
|
||||||
|
|
||||||
Warning! Due to how the argument handling works, you can do this:
|
|
||||||
$ zpac -wdd /tmp/workdir package
|
|
||||||
Where /tmp/workdir is an argument to w. Don't do this. But it works, unfortunately.
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +138,41 @@ abs.get() {
|
|||||||
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
|
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args_norm() {
|
||||||
|
declare arg opt c
|
||||||
|
declare -g argv
|
||||||
|
|
||||||
|
while (( $# )); do
|
||||||
|
unset -v arg opt c
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
(--) argv+=( "$1" ); break;;
|
||||||
|
|
||||||
|
(--*)
|
||||||
|
IFS='=' read arg opt <<< "$1"
|
||||||
|
argv+=( "$arg" )
|
||||||
|
|
||||||
|
[[ "$opt" ]] && {
|
||||||
|
argv+=( "$opt" )
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
|
||||||
|
(-*)
|
||||||
|
while read -n1 c
|
||||||
|
do
|
||||||
|
case "$c" in
|
||||||
|
-|'') :;;
|
||||||
|
*) argv+=( "-$c" );;
|
||||||
|
esac
|
||||||
|
done <<< "$1"
|
||||||
|
;;
|
||||||
|
|
||||||
|
(*) argv+=( "$1" );;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ -f "$HOME/.config/zpac.rc.sh" ]]; then
|
if [[ -f "$HOME/.config/zpac.rc.sh" ]]; then
|
||||||
source "$HOME/.config/zpac.rc.sh"
|
source "$HOME/.config/zpac.rc.sh"
|
||||||
@@ -151,43 +182,34 @@ main() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
|
|
||||||
|
(-h) usage; return 0;;
|
||||||
|
|
||||||
|
(-s) action='search';;
|
||||||
|
(-A)
|
||||||
|
action='search'
|
||||||
|
flag_search_aur=1;;
|
||||||
|
(-S)
|
||||||
|
action='search'
|
||||||
|
flag_search_syncdb=1;;
|
||||||
|
|
||||||
|
(-d)
|
||||||
|
if [[ "$action" == 'get' ]]; then
|
||||||
|
flag_get_deps=1
|
||||||
|
else
|
||||||
|
action='get'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
(-w)
|
||||||
|
cfg_workdir="$2"
|
||||||
|
shift;;
|
||||||
|
|
||||||
|
(-f) flag_force=1;;
|
||||||
|
|
||||||
(-*)
|
(-*)
|
||||||
while read -n1 c
|
err "Unknown key: $1"
|
||||||
do
|
usage
|
||||||
case "$c" in
|
return 1
|
||||||
(-|'') :;;
|
|
||||||
|
|
||||||
(h) usage; return 0;;
|
|
||||||
|
|
||||||
(s) action='search';;
|
|
||||||
(A)
|
|
||||||
action='search'
|
|
||||||
flag_search_aur=1;;
|
|
||||||
(S)
|
|
||||||
action='search'
|
|
||||||
flag_search_syncdb=1;;
|
|
||||||
|
|
||||||
(d)
|
|
||||||
if [[ "$action" == 'get' ]]; then
|
|
||||||
flag_get_deps=1
|
|
||||||
else
|
|
||||||
action='get'
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
(w)
|
|
||||||
cfg_workdir="$2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
(f) flag_force=1;;
|
|
||||||
|
|
||||||
(*)
|
|
||||||
err "Unknown key: $1"
|
|
||||||
usage
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<< "$1"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(*) break;;
|
(*) break;;
|
||||||
@@ -273,4 +295,5 @@ main() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
args_norm "$@"
|
||||||
|
main "${argv[@]}"
|
||||||
|
Reference in New Issue
Block a user