From a63579035a0918e805f5b7caead0448e8d463a4b Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Fri, 23 Mar 2012 14:31:16 +0100 Subject: [PATCH] bee-init: add --define option to pre-define ENV variables in the bee-file new @BEE_DFINES@ must be added to templates if you want to support this. --define A="B C" is problematik due to some unknown quoting bug in bash->beegetopt tranfsormation. this needs to be fixed. 8) but --define ROOT_DIR=/usr/whatever works just fine 8) --- conf/templates/fallback | 2 ++ src/bee-init.sh.in | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/conf/templates/fallback b/conf/templates/fallback index f3d5823..9b47347 100644 --- a/conf/templates/fallback +++ b/conf/templates/fallback @@ -14,6 +14,8 @@ PATCHURL[0]="" @DEFAULT_PREFIX_VARS@ +@BEE_DEFINES@ + #mee_extract() { # bee_extract ${@} #} diff --git a/src/bee-init.sh.in b/src/bee-init.sh.in index 0003a90..efc2c58 100644 --- a/src/bee-init.sh.in +++ b/src/bee-init.sh.in @@ -55,6 +55,8 @@ function usage() { -f --force force overwrite of bee-file. -h --help this little help. -V --version print version number. + -D --define=A=B define ENV variables with the bee-file. + (extra (over)quoting may be needed if B contains spaces.) Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @@ -240,6 +242,9 @@ function initialize() { sed -e "s,@DEFAULT_PREFIX_VARS@,${DEFAULT_PREFIX_VARS}," \ -i ${beefile} + sed -e "s,@BEE_DEFINES@,${OPT_DEFINE}," \ + -i ${beefile} + if [ "${CONFIGURE_BEEHAVIOR}" ] ; then sed -e "s,@BEE_CONFIGURE@,BEE_CONFIGURE=${CONFIGURE_BEEHAVIOR}," \ -i ${beefile} @@ -265,6 +270,7 @@ options=$(${BEE_BINDIR}/beegetopt --name bee-init \ --option disable-versionify \ --option help/h \ --option version/V \ + --option define/D= \ --option template/t= \ --option force/f \ --option configure= \ @@ -356,6 +362,11 @@ while true ; do shift 2 ;; + --define) + OPT_DEFINE="${OPT_DEFINE}\n${2}" + shift 2 + ;; + --buildtype) OPT_BUILDTYPE="${2}" shift 2