Skip to content

Commit dda069a

Browse files
committed
feat(chezmoi): add keep_going option for error handling
1 parent cc0306f commit dda069a

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/chezmoi/devcontainer-feature.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "chezmoi",
33
"id": "chezmoi",
4-
"version": "1.5.2",
4+
"version": "1.6.0",
55
"description": "Install chezmoi",
66
"documentationURL": "https://github.com/ckagerer/devcontainer-features/tree/main/src/chezmoi",
77
"options": {
@@ -29,6 +29,11 @@
2929
"type": "string",
3030
"default": "",
3131
"description": "The key to use for Atuin. Leave empty if you don't want to use Atuin."
32+
},
33+
"keep_going": {
34+
"type": "boolean",
35+
"default": false,
36+
"description": "Ignore errors during setup and continue execution."
3237
}
3338
},
3439
"postCreateCommand": "/usr/local/share/chezmoi-atuin-init.sh",

src/chezmoi/install.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/usr/bin/env sh
2+
# (C) Copyright 2025 Christian Kagerer
3+
# Purpose: Install chezmoi and initialize dotfiles from DOTFILES_REPO
24

3-
set -ex
5+
if [ "${KEEP_GOING:-false}" = "true" ]; then
6+
set +e
7+
else
8+
set -e
9+
fi
10+
set -x
411

512
CHEZMOI_USER="${CHEZMOI_USER:-$_REMOTE_USER}"
613

@@ -95,7 +102,17 @@ INIT_ATUIN_SCRIPT_PATH="/usr/local/share/chezmoi-atuin-init.sh"
95102

96103
tee "$INIT_ATUIN_SCRIPT_PATH" >/dev/null <<EOF
97104
#!/usr/bin/env bash
98-
set -ex
105+
# (C) Copyright 2025 Christian Kagerer
106+
# Purpose: Initialize Atuin login and sync for chezmoi devcontainer feature
107+
108+
KEEP_GOING="\${KEEP_GOING:-false}"
109+
110+
if [[ "\${KEEP_GOING}" == "true" ]]; then
111+
set +o errexit +o nounset +o pipefail
112+
else
113+
set -o errexit -o nounset -o pipefail
114+
fi
115+
set -x
99116
100117
ATUIN_USER="${ATUIN_USER}"
101118
ATUIN_PASSWORD="${ATUIN_PASSWORD}"

0 commit comments

Comments
 (0)