From bae156b212213a9fda5eb093f4edfee6b56f5372 Mon Sep 17 00:00:00 2001 From: Peter Pathirana Date: Fri, 5 Jul 2024 05:22:45 +0000 Subject: [PATCH] fix: fix up some misc bugs in workspace template and image --- images/homelab-workspace/coder/agent-startup.sh | 2 +- images/homelab-workspace/coder/entrypoint-prepare.sh | 4 ++-- templates/docker/homelab-workspace/main.tf | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/homelab-workspace/coder/agent-startup.sh b/images/homelab-workspace/coder/agent-startup.sh index 1118a3e1..2f362398 100755 --- a/images/homelab-workspace/coder/agent-startup.sh +++ b/images/homelab-workspace/coder/agent-startup.sh @@ -20,7 +20,7 @@ create_log_file() { } install_rust() { - if [[ ! -d $HOME/.rustup && ! -z "$RUST_VERSION" ]]; then + if [[ ! -d ~/.rustup/toolchains/${RUST_VERSION:?}-$(arch)-unknown-linux-gnu ]]; then echo "$HOME/.rustup is not present, installing rust $RUST_VERSION ..." rustup default ${RUST_VERSION} 2>&1 else diff --git a/images/homelab-workspace/coder/entrypoint-prepare.sh b/images/homelab-workspace/coder/entrypoint-prepare.sh index c1edeb8a..3280e8a4 100755 --- a/images/homelab-workspace/coder/entrypoint-prepare.sh +++ b/images/homelab-workspace/coder/entrypoint-prepare.sh @@ -43,8 +43,8 @@ maintain_directories() { local home_dir="/home/${username}" echo "- Creating directories..." - mkdir $home_dir - mkdir $home_dir/.log/ + mkdir -p $home_dir + mkdir -p $home_dir/.log/ echo "- Updating directory permissions..." chown $username:coder $home_dir chown $username:coder $home_dir/.log/ diff --git a/templates/docker/homelab-workspace/main.tf b/templates/docker/homelab-workspace/main.tf index e015d285..b28305ca 100644 --- a/templates/docker/homelab-workspace/main.tf +++ b/templates/docker/homelab-workspace/main.tf @@ -32,7 +32,7 @@ locals { username = local.test_mode ? "coder" : data.coder_workspace_owner.me.name container_volume_mounts = { - "home" = "/home/coder", + "home" = "/home/${local.username}", "docker" = "/var/lib/docker" } bind_mount_host_paths = {