-
Notifications
You must be signed in to change notification settings - Fork 1
/
dev-setup
executable file
·53 lines (45 loc) · 1.32 KB
/
dev-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
shopt -s nullglob
if [ -n "$BASH_SOURCE" ]; then
THIS_SCRIPT=$BASH_SOURCE
elif [ -n "$ZSH_NAME" ]; then
THIS_SCRIPT=$0
else
THIS_SCRIPT="$(pwd)/dev-setup"
if [ ! -e "$THIS_SCRIPT" ]; then
echo "Error: $THIS_SCRIPT doesn't exist!" >&2
echo "Please run this script in dev-setup's directory." >&2
exit 1
fi
fi
THIS_SCRIPT=$(realpath "$THIS_SCRIPT")
THIS_DIR=$(dirname "$THIS_SCRIPT")
LAYERS="$THIS_DIR/meta-confidential-compute \
$THIS_DIR/meta-openembedded/meta-oe \
$THIS_DIR/meta-openembedded/meta-python \
$THIS_DIR/meta-openembedded/meta-networking \
$THIS_DIR/meta-openembedded/meta-filesystems \
$THIS_DIR/meta-virtualization \
$THIS_DIR/meta-rust-bin \
$THIS_DIR/meta-dstack"
if [ -z "$1" ]; then
BUILD_DIR=$THIS_DIR/bb-build
else
BUILD_DIR=$(realpath "$1")
fi
if [ ! -f "$BUILD_DIR/conf/local.conf" ]; then
mkdir -p "$BUILD_DIR/conf"
cp -f "$THIS_DIR/bb-build/conf/local.conf" "$BUILD_DIR/conf/local.conf"
fi
OE_INIT=$THIS_DIR/poky/oe-init-build-env
for script in $THIS_DIR/setup.d/*.sh; do
source "$script"
done
pushd .
source $OE_INIT $BUILD_DIR
popd
bitbake-layers add-layer $LAYERS
# Add scripts/bin to PATH if not already present
if [[ ":$PATH:" != *":$THIS_DIR/scripts/bin:"* ]]; then
export PATH=$PATH:$THIS_DIR/scripts/bin
fi