[pacman-dev] [PATCH v4 6/8] bacman: add otpion to alter the output directory
Gordian Edenhofer
gordian.edenhofer at gmail.com
Thu Sep 1 13:43:21 UTC 2016
Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
Switch to the build-in check for a directory existance instead of using 'readlink -e'.
contrib/bacman.sh.in | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
index 0ae9da0..fef5e78 100644
--- a/contrib/bacman.sh.in
+++ b/contrib/bacman.sh.in
@@ -57,9 +57,11 @@ usage() {
-q, --quiet silence most of the status reporting
--nocolor turn off color in output
--pacnew package .pacnew files
+ -o, --out <dir> write output to <dir>
Examples: # $myname linux-headers
- # $myname --nocolor --pacnew gzip munge binutils
+ # $myname gzip munge binutils -o ~/Downloads
+ # $myname --nocolor --pacnew -o /tmp -j 5 gzip munge binutils
# $myname \$(pacman -Qsq)
EOF
}
@@ -87,8 +89,8 @@ for option in "$@"; do
done
# Parse arguments
-OPT_SHORT='qv'
-OPT_LONG=('quiet' 'nocolor' 'pacnew' 'version')
+OPT_SHORT='o:qv'
+OPT_LONG=('out:' 'quiet' 'nocolor' 'pacnew' 'version')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
usage
exit 1
@@ -98,6 +100,10 @@ unset OPT_SHORT OPT_LONG OPTRET
while :; do
case "$1" in
+ -o|--out)
+ pkg_dest=$2
+ [[ ! -d "$2" ]] && echo -e "The directory \e[39;1m$2\e[0m does not exist!" && exit 3
+ shift ;;
-q|--quiet)
QUIET=1 ;;
--nocolor)
@@ -149,7 +155,8 @@ source "@sysconfdir@/makepkg.conf"
if [[ -r ~/.makepkg.conf ]]; then
source ~/.makepkg.conf
fi
-pkg_dest="${PKGDEST:-$PWD}"
+PKGDEST="${PKGDEST:-$PWD}"
+pkg_dest="${pkg_dest:-$PKGDEST}"
pkg_pkger="${PACKAGER:-'Unknown Packager'}"
# Check for an existing database
--
2.9.3
More information about the pacman-dev
mailing list