-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathinit_workspace
More file actions
executable file
·72 lines (60 loc) · 2.14 KB
/
init_workspace
File metadata and controls
executable file
·72 lines (60 loc) · 2.14 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# This script is exectued in the host environment,
# before the VS Code dev-container build.
CONTAINER_TAG=$(cat .devcontainer/devcontainer.json | grep "ghcr.io" | awk -F ":" '{print $3}' | awk -F "\"" '{print $1}')
echo "Setting EBcL workspace up..."
echo "Using EBcL container ${CONTAINER_TAG}."
# Create tools folder
mkdir -p tools
# Create cache folders
mkdir -p state/cache
mkdir -p state/apt
source .env
# Copy user config
if [ -d "${HOME}/.ebcl_config" ]; then
echo "Copying user config..."
rm -rf tools/user_config
mkdir -p tools/user_config
cp -R ~/.ebcl_config/* tools/user_config
cp -R ~/.ebcl_config/.env tools/user_config
else
echo "No user config found. You can provide your own init scripts in ~/.ebcl_config"
fi
# source user env, if it exists
ENV="tools/user_config/.env"
if [ -f "$ENV" ]; then
echo "Sourcing '${ENV}'..."
source $ENV
fi
# Copy SSH keys
if [ ${COPY_SSH} -eq 1 ]; then
echo "Copying SSH keys from host..."
if [ -d ${HOME}/.ssh ]; then
echo "Copying SSH folder to tools..."
rm -rf tools/.ssh
mkdir -p tools/.ssh
cp -R ${HOME}/.ssh/* tools/.ssh/
echo "Copied keys:"
ls -lah tools/.ssh/*
else
echo "No .ssh folder found!"
fi
else
echo "Not copying SSH keys from host."
fi
echo ""
echo "---------------------------------------------------------------------------"
echo "Checking binfmt support"
echo "---------------------------------------------------------------------------"
ARCH=$(uname -m)
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
echo "ARM platform detected. No QEMU binfmt support is required."
elif [ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ] && which qemu-aarch64-static > /dev/null; then
echo "QEMU binfmt support is already enabled."
else
echo "Error: QEMU binfmt support is missing. Please install the required packages and try again."
echo "On Ubuntu run: sudo apt install qemu-user-static binfmt-support"
echo "On Arch run: sudo pacman -S qemu-user-static qemu-user-static-binfmt"
exit 1
fi
echo "---------------------------------------------------------------------------"