-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentrypoint-dev.sh
More file actions
executable file
·58 lines (47 loc) · 1.53 KB
/
entrypoint-dev.sh
File metadata and controls
executable file
·58 lines (47 loc) · 1.53 KB
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
54
55
56
57
58
#!/bin/bash
# Installing specific version as the CMakeLists.txt file uses `-n`
# present from 9 version onwards, not present in Zephyr base container
install_xxd() {
if xxd --help 2>&1 | grep -q "\-n"; then
echo "xxd with -n flag already installed"
return 0
fi
echo "Building xxd from vim 9.1 source..."
cd /tmp
rm -rf vim
git clone --depth 1 --branch v9.1.0 https://github.com/vim/vim.git
cd vim/src/xxd
make
cp xxd /usr/local/bin/xxd
chmod +x /usr/local/bin/xxd
cd /
rm -rf /tmp/vim
echo "xxd installed successfully"
}
init_zephyr_env() {
if [ ! -f /workspace/.west/config ]; then
west init -l /workspace/application
cd /workspace/application
west update
touch /workspace/.west/initialized
echo "West workspace initialized successfully"
else
echo "West workspace already initialized"
fi
if [ -f /workspace/zephyr/zephyr-env.sh ]; then
echo "Sourcing Zephyr environment..."
source /workspace/zephyr/zephyr-env.sh
fi
if [ ! -f /root/.zephyr_sourced ]; then
echo 'if [ -f /workspace/zephyr/zephyr-env.sh ]; then source /workspace/zephyr/zephyr-env.sh; fi' >> /root/.bashrc
touch /root/.zephyr_sourced
fi
}
set -e
echo "Initializing west workspace..."
git config --global --add safe.directory /workspace/application
git config --global --add safe.directory /workspace/application
git config --global --add safe.directory /workspace/ocre-sdk
install_xxd
init_zephyr_env
exec "$@"