diff options
-rwxr-xr-x | scripts/oe-setup-builddir | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir index 70f2245b16..69c33049c7 100755 --- a/scripts/oe-setup-builddir +++ b/scripts/oe-setup-builddir | |||
@@ -7,10 +7,12 @@ | |||
7 | # SPDX-License-Identifier: GPL-2.0-or-later | 7 | # SPDX-License-Identifier: GPL-2.0-or-later |
8 | # | 8 | # |
9 | 9 | ||
10 | if [ -z "$BUILDDIR" ]; then | 10 | die() { |
11 | echo >&2 "Error: The build directory (BUILDDIR) must be set!" | 11 | echo Error: "$@" >&2 |
12 | exit 1 | 12 | exit 1 |
13 | fi | 13 | } |
14 | |||
15 | [ -n "$BUILDDIR" ] || die "The build directory (BUILDDIR) must be set!" | ||
14 | 16 | ||
15 | if [ "$1" = '--help' -o "$1" = '-h' ]; then | 17 | if [ "$1" = '--help' -o "$1" = '-h' ]; then |
16 | echo 'Usage: oe-setup-builddir' | 18 | echo 'Usage: oe-setup-builddir' |
@@ -22,15 +24,9 @@ fi | |||
22 | 24 | ||
23 | mkdir -p "$BUILDDIR/conf" | 25 | mkdir -p "$BUILDDIR/conf" |
24 | 26 | ||
25 | if [ ! -d "$BUILDDIR" ]; then | 27 | [ -d "$BUILDDIR" ] || die "The build directory ($BUILDDIR) does not exist!" |
26 | echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" | 28 | [ -w "$BUILDDIR" ] || |
27 | exit 1 | 29 | die "Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build" |
28 | fi | ||
29 | |||
30 | if [ ! -w "$BUILDDIR" ]; then | ||
31 | echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build" | ||
32 | exit 1 | ||
33 | fi | ||
34 | 30 | ||
35 | # Attempting removal of sticky,setuid bits from BUILDDIR, BUILDDIR/conf | 31 | # Attempting removal of sticky,setuid bits from BUILDDIR, BUILDDIR/conf |
36 | chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" | 32 | chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" |
@@ -59,15 +55,12 @@ if [ -n "$TEMPLATECONF" ]; then | |||
59 | if [ -d "$OEROOT/$TEMPLATECONF" ]; then | 55 | if [ -d "$OEROOT/$TEMPLATECONF" ]; then |
60 | TEMPLATECONF="$OEROOT/$TEMPLATECONF" | 56 | TEMPLATECONF="$OEROOT/$TEMPLATECONF" |
61 | fi | 57 | fi |
62 | if [ ! -d "$TEMPLATECONF" ]; then | 58 | [ -d "$TEMPLATECONF" ] || |
63 | echo >&2 "Error: TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'" | 59 | die "TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'" |
64 | exit 1 | ||
65 | fi | ||
66 | fi | 60 | fi |
67 | templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" $TEMPLATECONF) | 61 | templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" $TEMPLATECONF) |
68 | if [ ! -f "$TEMPLATECONF/../../layer.conf" -o $templatesdir != "templates" ]; then | 62 | if [ ! -f "$TEMPLATECONF/../../layer.conf" -o $templatesdir != "templates" ]; then |
69 | echo >&2 "Error: TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name" | 63 | die "TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name" |
70 | exit 1 | ||
71 | fi | 64 | fi |
72 | OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" | 65 | OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" |
73 | OECORELOCALCONF="$TEMPLATECONF/local.conf.sample" | 66 | OECORELOCALCONF="$TEMPLATECONF/local.conf.sample" |