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" ]
Signed-off-by: Matthieu Crapet
---
scripts/oe-setup-builddir | 47 ---
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index e4356f1..c91e079 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -25,51 +25,51 @@ fi
mkdir -p $BUILDDIR/conf
-if ! (test -d "$BUILDDIR"); then
+if [ ! -d "$BUILDDIR" ]; then
echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
exit 1
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"
exit 1
fi
cd "$BUILDDIR"
-if (test -f "$BUILDDIR/conf/templateconf.cfg") then
+if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
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
fi
#
# $TEMPLATECONF can point to a directory for the template local.conf &
bblayers.conf
#
-if [ "x" != "x$TEMPLATECONF" ]; then
-if ! (test -d "$TEMPLATECONF"); then
- # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
- if [ -d "$OEROOT/$TEMPLATECONF" ]; then
- TEMPLATECONF="$OEROOT/$TEMPLATECONF"
- fi
- if ! (test -d "$TEMPLATECONF"); then
- echo >&2 "Error: '$TEMPLATECONF' must be a directory containing
local.conf & bblayers.conf"
- return
- fi
+if [ -n "$TEMPLATECONF" ]; then
+if [ ! -d "$TEMPLATECONF" ]; then
+# Allow TEMPLATECONF=meta-xyz/conf as a shortcut
+if [ -d "$OEROOT/$TEMPLATECONF" ]; then
+TEMPLATECONF="$OEROOT/$TEMPLATECONF"
+fi
+if [ ! -d "$TEMPLATECONF" ]; then
+echo >&2 "Error: '$TEMPLATECONF' must be a directory containing
local.conf & bblayers.conf"
+exit 1
+fi
fi
OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
fi
-if [ "x" = "x$OECORELOCALCONF" ]; then
+if [ -z "$OECORELOCALCONF" ]; then
OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
fi
-if ! (test -r "$BUILDDIR/conf/local.conf"); then
+if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
cat <
$BUILDDIR/conf/bblayers.conf
# ##COREBASE## is deprecated as it's meaning was inconsistent, but continue
# 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
# Prevent disturbing a new GIT clone in same console
@@ -126,7 +127,7 @@ cat <'
EOM
-if [ "x" = "x$OECORENOTESCONF" ]; then
+if [ -z "$OECORENOTESCONF" ]; then
OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
fi
[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
--
1.8.5.4
--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core