From f4b7b15af661df6cf886a1bafbe9bfba302400ed Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Mon, 19 Mar 2012 15:36:12 +0100 Subject: [PATCH 1/3] bee: added new option --destdir if --destdir is specified, a variable containing the value of --destdir named BEE_BEEDESTDIR will be exported and may be used in other bee-tools --- src/bee.sh.in | 18 ++++++++++++++++++ src/beelib.config.sh.in | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/bee.sh.in b/src/bee.sh.in index 856f3fd..e875620 100644 --- a/src/bee.sh.in +++ b/src/bee.sh.in @@ -59,6 +59,7 @@ function print_usage() { bee --print-config bee --help bee --version + bee --destdir=/path/to/destdir EOF } @@ -83,6 +84,23 @@ function search_tool_cmd { done } +options=$(${BEE_BINDIR}/beegetopt --name=bee \ + --option=destdir/d= \ + -- "${@}") + +eval set -- ${options} + +while true ; do + case "${1}" in + --destdir) + BEE_BEEDESTDIR=${2} + shift 2 + ;; + --) + shift + break; + esac +done options=$(${BEE_BINDIR}/beegetopt --name=bee \ --stop-on-no-option \ diff --git a/src/beelib.config.sh.in b/src/beelib.config.sh.in index cd06b25..b153eb9 100644 --- a/src/beelib.config.sh.in +++ b/src/beelib.config.sh.in @@ -352,6 +352,8 @@ function config_export() { export BEE_DATADIR export BEE_LIBEXECDIR + export BEE_BEEDESTDIR + export BEE_VERSION export XDG_CONFIG_HOME From 2c566027c70621a087bb4354e3b004646880d138 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Mon, 19 Mar 2012 15:42:34 +0100 Subject: [PATCH 2/3] bee: prepend BEE_BEEDESTDIR to BEE_METADIR and BEE_CACHEDIR --- src/bee.sh.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bee.sh.in b/src/bee.sh.in index e875620..3027b37 100644 --- a/src/bee.sh.in +++ b/src/bee.sh.in @@ -154,6 +154,9 @@ if [ "${TOOL}" = "init" ] ; then config_export_prefix_variables fi +BEE_METADIR=${BEE_BEEDESTDIR}${BEE_METADIR} +BEE_CACHEDIR=${BEE_BEEDESTDIR}${BEE_CACHEDIR} + if [ "${OPT_PRINTCONFIG}" = "1" ] ; then config_print exit 0 From 4ae4163441a0ee6ce6b57bc6f6b6d2b4ccfc0d48 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Mon, 19 Mar 2012 15:44:16 +0100 Subject: [PATCH 3/3] bee-install: extract files into BEE_BEEDESTDIR, if it is set --- src/bee-install.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bee-install.sh.in b/src/bee-install.sh.in index 831aa16..b844ceb 100644 --- a/src/bee-install.sh.in +++ b/src/bee-install.sh.in @@ -354,7 +354,12 @@ function do_install_file() { vv="vv" fi + if [ -n "${BEE_BEEDESTDIR}" ] ; then + changedir="--transform=s,^/,${BEE_BEEDESTDIR}/," + fi + start_cmd tar -x --dereference -${vv}Pf ${file} \ + ${changedir} \ --transform="s,^FILES$,${BEE_METADIR}/${pkg}/FILES," \ --transform="s,^BUILD$,${BEE_METADIR}/${pkg}/${beefile}," \ --transform="s,^META$,${BEE_METADIR}/${pkg}/META," \