From a6add0993de2813956449c9f6be82a03256379c4 Mon Sep 17 00:00:00 2001 From: Christian Kagerer Date: Sun, 18 Aug 2024 11:12:40 +0200 Subject: [PATCH] feat(chezmoi): add option for branch --- src/chezmoi/devcontainer-feature.json | 7 ++++++- src/chezmoi/install.sh | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/chezmoi/devcontainer-feature.json b/src/chezmoi/devcontainer-feature.json index f3f6cdc..23129e1 100644 --- a/src/chezmoi/devcontainer-feature.json +++ b/src/chezmoi/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "chezmoi", "id": "chezmoi", - "version": "1.3.1", + "version": "1.4.0", "description": "Install chezmoi", "documentationURL": "https://github.com/ckagerer/devcontainer-features/tree/main/src/chezmoi", "options": { @@ -10,6 +10,11 @@ "default": "twpayne/dotfiles", "description": "The dotfiles repository to clone." }, + "chezmoi_branch": { + "type": "string", + "default": "", + "description": "The branch to use for chezmoi. Empty for default branch." + }, "atuin_user": { "type": "string", "default": "", diff --git a/src/chezmoi/install.sh b/src/chezmoi/install.sh index e48b60f..541119e 100644 --- a/src/chezmoi/install.sh +++ b/src/chezmoi/install.sh @@ -43,6 +43,9 @@ CHEZMOI_USER_HOME="$(getent passwd "${CHEZMOI_USER}" | cut -d: -f6)" # run chezmoi CHEZMOI_ARGS=("init" "--apply") +if [ -n "${CHEZMOI_BRANCH}" ]; then + CHEZMOI_ARGS+=("--branch" "${CHEZMOI_BRANCH}") +fi CMD="chezmoi ${CHEZMOI_ARGS[*]} ${DOTFILES_REPO}" sudo --user "${CHEZMOI_USER}" bash -c "cd ${CHEZMOI_USER_HOME} && REMOTE_CONTAINERS=1 ${CMD}"