-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathinit_container
executable file
·93 lines (76 loc) · 2.39 KB
/
init_container
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# This script is exectued in the container environment,
# after the VS Code dev-container build.
echo "EBcL template ${WS_VERSION}"
echo "Setting EBcL container up..."
# Move SSH keys
if [ -d "tools/.ssh" ]; then
echo "SSH keys found."
if [ ! -d "~/.ssh" ]; then
mkdir -p ~/.ssh
fi
echo "Moving ssh keys to ~/.ssh"
rm -rf ~/.ssh/*
mv tools/.ssh/* ~/.ssh/
echo "Deleting copied SSH keys from tools."
rm -rf tools/.ssh
else
echo "No SSH keys found."
fi
# Setup /build folder
echo "Linking workspace to build folder..."
for folder in results/images results/packages results/apps images identity sysroot_x86_64 sysroot_aarch64
do
sudo rm -rf /build/${folder}
sudo ln -s /workspace/${folder} /build/${folder}
done
# source user env, if it exists
ENV="tools/user_config/.env"
if [ -f "$ENV" ]; then
echo "Sourcing '${ENV}'..."
source $ENV
fi
# Run user setup
if [ -d "/workspace/tools/user_config" ]; then
echo "Running user setup..."
if [ -f "/workspace/tools/user_config/settings.json" ]; then
echo "Overwriting VS Code settings..."
rm -f /workspace/.vscode/settings.json
cp /workspace/tools/user_config/settings.json /workspace/.vscode/settings.json
fi
else
echo "No user config found. You can provide your own init scripts in ~/.ebcl_config"
fi
# Link tools to tools folder
mkdir -p /workspace/tools
for tool in embdgen ebcl_build_tools ebcl_vscode_tools
do
if [ ! -L /workspace/tools/${tool} ]; then
echo "Symlinking ${tool} as tools/${tool}..."
ln -s /build/${tool} /workspace/tools/${tool}
fi
done
# Clone additional images
if [ ! -z "$IMAGE_REPO" ]; then
echo "Cloning additional image repo..."
git clone $IMAGE_REPO /workspace/images/extra
fi
# Clone additional apps
if [ ! -z "$APP_REPO" ]; then
echo "Cloning additional apps repo..."
git clone $APP_REPO /workspace/apps/extra
fi
# Clone user images
if [ ! -z "$USER_IMAGE_REPO" ]; then
echo "Cloning user image repo..."
git clone $USER_IMAGE_REPO /workspace/images/user
fi
# Clone user apps
if [ ! -z "$USER_APP_REPO" ]; then
echo "Cloning user apps repo..."
git clone $USER_APP_REPO /workspace/apps/user
fi
# Generate VS Code build tasks
generate_build_tasks
# Workaround for robot tests
sudo bash -c 'echo "/workspace/robot_tests/lib" > /build/venv/lib/python3.10/site-packages/_Fakeroot.pth' || true