From 931184a787e1c43776c75e4c26477c2355346711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20K=C3=A5re=20Skj=C3=B8restad?= <10708951+larskaare@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:22:21 +0100 Subject: [PATCH] Explore more robust post create command (#33) * Move postCreateCommand into separate file, source .zshrc after update * Remove openFiles (welcome.txt) * Update trufflehog version to latest --- .devcontainer/devcontainer.json | 11 ++--------- src/define-environment.sh | 5 +++++ 2 files changed, 7 insertions(+), 9 deletions(-) create mode 100755 src/define-environment.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b723921..502a624 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -56,20 +56,13 @@ "terminal.integrated.defaultProfile.linux": "zsh", "csharp.suppressBuildAssetsNotification": true } - }, - "codespaces": { - "openFiles": [ - ".devcontainer/welcome.txt" - ] } }, "updateContentCommand": { - "trufflehog": "curl -L https://github.com/trufflesecurity/trufflehog/releases/download/v3.63.3/trufflehog_3.63.3_linux_amd64.tar.gz| tar -xz -C /tmp/ && sudo mv /tmp/trufflehog /usr/local/bin/" + "trufflehog": "curl -L https://github.com/trufflesecurity/trufflehog/releases/download/v3.82.13/trufflehog_3.82.13_linux_amd64.tar.gz| tar -xz -C /tmp/ && sudo mv /tmp/trufflehog /usr/local/bin/" }, "postCreateCommand": { - "sed": "sed -i 's/ZSH_THEME=\\\"devcontainers\\\"/ZSH_THEME=\\\"avit\\\"/g' ~/.zshrc", - "addPath": "echo 'export PATH=$PATH:$CODESPACE_VSCODE_FOLDER/src' >> ~/.zshrc", - "cloc": "sudo apt update && sudo apt install -y cloc" + "define-environment": "./src/define-environment.sh; source ~/.zshrc" }, "containerEnv": { "PIPELINE": "development", diff --git a/src/define-environment.sh b/src/define-environment.sh new file mode 100755 index 0000000..6139c01 --- /dev/null +++ b/src/define-environment.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +echo 'export PATH=$CODESPACE_VSCODE_FOLDER/src:$PATH' >> ~/.zshrc +sed -i 's/ZSH_THEME="devcontainers"/ZSH_THEME="avit"/' ~/.zshrc +sudo apt update -qq && sudo apt install -y -qq cloc