oe-setup-builddir: small rework
Changes: - drop useless subshell creation in test: if ! (test -r "$BUILDDIR/conf/local.conf"); then$ - replace "source" builtin by "." (bashsism) - fix indentation 4 spaces (drop some tabs too) - fix return => exit (return is not allowed in main) - drop "sed -i" (doesn't exist in BSD sed) - for homogeneity, always use [ ] (instead of test) - replace old [ "x" = "x$VAR" ] by [ -z "$VAR" ] (From OE-Core rev: 3a116577446f02bda0ef4e035360293ff73c9eef) Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
9104a32196
commit
9a928c5f12
|
@ -25,51 +25,51 @@ fi
|
||||||
|
|
||||||
mkdir -p $BUILDDIR/conf
|
mkdir -p $BUILDDIR/conf
|
||||||
|
|
||||||
if ! (test -d "$BUILDDIR"); then
|
if [ ! -d "$BUILDDIR" ]; then
|
||||||
echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
|
echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! (test -w "$BUILDDIR"); then
|
if [ ! -w "$BUILDDIR" ]; then
|
||||||
echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
|
echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$BUILDDIR"
|
cd "$BUILDDIR"
|
||||||
|
|
||||||
if (test -f "$BUILDDIR/conf/templateconf.cfg") then
|
if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
|
||||||
TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
|
TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $OEROOT/.templateconf
|
. $OEROOT/.templateconf
|
||||||
|
|
||||||
if ! (test -f "$BUILDDIR/conf/templateconf.cfg") then
|
if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
|
||||||
echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg
|
echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
|
# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
|
||||||
#
|
#
|
||||||
if [ "x" != "x$TEMPLATECONF" ]; then
|
if [ -n "$TEMPLATECONF" ]; then
|
||||||
if ! (test -d "$TEMPLATECONF"); then
|
if [ ! -d "$TEMPLATECONF" ]; then
|
||||||
# Allow TEMPLATECONF=meta-xyz/conf as a shortcut
|
# Allow TEMPLATECONF=meta-xyz/conf as a shortcut
|
||||||
if [ -d "$OEROOT/$TEMPLATECONF" ]; then
|
if [ -d "$OEROOT/$TEMPLATECONF" ]; then
|
||||||
TEMPLATECONF="$OEROOT/$TEMPLATECONF"
|
TEMPLATECONF="$OEROOT/$TEMPLATECONF"
|
||||||
fi
|
fi
|
||||||
if ! (test -d "$TEMPLATECONF"); then
|
if [ ! -d "$TEMPLATECONF" ]; then
|
||||||
echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
|
echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
|
||||||
return
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
|
OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
|
||||||
OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
|
OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
|
||||||
OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
|
OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x" = "x$OECORELOCALCONF" ]; then
|
if [ -z "$OECORELOCALCONF" ]; then
|
||||||
OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
|
OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
|
||||||
fi
|
fi
|
||||||
if ! (test -r "$BUILDDIR/conf/local.conf"); then
|
if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
|
||||||
cat <<EOM
|
cat <<EOM
|
||||||
You had no conf/local.conf file. This configuration file has therefore been
|
You had no conf/local.conf file. This configuration file has therefore been
|
||||||
created for you with some default values. You may wish to edit it to use a
|
created for you with some default values. You may wish to edit it to use a
|
||||||
|
@ -88,11 +88,11 @@ EOM
|
||||||
cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
|
cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x" = "x$OECORELAYERCONF" ]; then
|
if [ -z "$OECORELAYERCONF" ]; then
|
||||||
OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
|
OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
|
||||||
fi
|
fi
|
||||||
if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
|
if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
|
||||||
cat <<EOM
|
cat <<EOM
|
||||||
You had no conf/bblayers.conf file. The configuration file has been created for
|
You had no conf/bblayers.conf file. The configuration file has been created for
|
||||||
you with some default values. To add additional metadata layers into your
|
you with some default values. To add additional metadata layers into your
|
||||||
configuration please add entries to this file.
|
configuration please add entries to this file.
|
||||||
|
@ -109,10 +109,11 @@ EOM
|
||||||
|
|
||||||
# Put the abosolute path to the layers in bblayers.conf so we can run
|
# Put the abosolute path to the layers in bblayers.conf so we can run
|
||||||
# bitbake without the init script after the first run
|
# bitbake without the init script after the first run
|
||||||
sed "s|##OEROOT##|$OEROOT|g" $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
|
|
||||||
# ##COREBASE## is deprecated as it's meaning was inconsistent, but continue
|
# ##COREBASE## is deprecated as it's meaning was inconsistent, but continue
|
||||||
# to replace it for compatibility.
|
# to replace it for compatibility.
|
||||||
sed -i -e "s|##COREBASE##|$OEROOT|g" $BUILDDIR/conf/bblayers.conf
|
sed -e "s|##OEROOT##|$OEROOT|g" \
|
||||||
|
-e "s|##COREBASE##|$OEROOT|g" \
|
||||||
|
$OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prevent disturbing a new GIT clone in same console
|
# Prevent disturbing a new GIT clone in same console
|
||||||
|
@ -126,7 +127,7 @@ cat <<EOM
|
||||||
You can now run 'bitbake <target>'
|
You can now run 'bitbake <target>'
|
||||||
|
|
||||||
EOM
|
EOM
|
||||||
if [ "x" = "x$OECORENOTESCONF" ]; then
|
if [ -z "$OECORENOTESCONF" ]; then
|
||||||
OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
|
OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
|
||||||
fi
|
fi
|
||||||
[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
|
[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
|
||||||
|
|
Loading…
Reference in New Issue