forked from eclipse-uprotocol/up-transport-iceoryx2-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost-create.sh
More file actions
executable file
·42 lines (36 loc) · 1.45 KB
/
post-create.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.45 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
#!/bin/bash
#region sudo stuff
HOST_OS=""
ARCH_AND_OS_FUNC="${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/get-arch-and-os.sh"
if [[ -f "$ARCH_AND_OS_FUNC" ]]; then
source $ARCH_AND_OS_FUNC
read -r _ HOST_OS <<< "$(get_arch_and_os)"
fi
if [[ "$HOST_OS" == "darwin" ]]; then # darwin == Mac OS
# This is a workaround which is againt necessary on MacOS 14.0, it looks like this bug is back:
# https://github.com/microsoft/vscode-dev-containers/issues/1487#issuecomment-1143907307
# grant permissions to mounted rust volume
echo "(Mac OS only) Granting permissions to mounted rust volume"
sudo chown vscode:vscode /rust-volume
# create /.cargo/config.toml in root folder
sudo mkdir /.cargo/
sudo touch /.cargo/config.toml
sudo bash -c "cat << EOF > /.cargo/config.toml
[build]
target-dir = \"/rust-volume/target\"
EOF"
fi
if ! grep -q "bashrc_addition" ~/.bashrc && [[ -f "${WORKSPACE_FOLDER}/.devcontainer/scripts/bashrc_addition.sh" ]]; then
echo "source ${WORKSPACE_FOLDER}/.devcontainer/scripts/bashrc_addition.sh" >> ~/.bashrc
fi
#endregion
for arg in "$@"; do
if [[ "$arg" == --workspace-folder=* ]]; then
WORKSPACE_FOLDER="${arg#--workspace-folder=}"
fi
done
INSTALL_RUST_TOOLCHAIN_FUNC="${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/install-rust-toolchain.sh"
if [[ -f "$INSTALL_RUST_TOOLCHAIN_FUNC" ]]; then
source $INSTALL_RUST_TOOLCHAIN_FUNC
install_rust_toolchain "$@"
fi