Skip to content

Commit

Permalink
feat(chezmoi): add option for branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ckagerer committed Aug 18, 2024
1 parent 44ae202 commit a6add09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/chezmoi/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": "",
Expand Down
3 changes: 3 additions & 0 deletions src/chezmoi/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down

0 comments on commit a6add09

Please sign in to comment.