Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ one-time machine setup.
8. `mise run bootstrap` runs a task named `bootstrap`, if one exists.
9. `[bootstrap.hooks.final]` runs after the bootstrap task, if configured.

Use `mise bootstrap --skip <part>` to skip specific parts. Supported parts are
`packages`, `dotfiles`, `defaults`, `launchd`, `systemd`, `user`, `tools`,
`task`, and `final-hook`. The flag can be repeated or comma-separated, for
example `mise bootstrap --skip tools,task`.

Hook phases can also run before and after the built-in steps:
`pre-packages`, `post-packages`, `pre-dotfiles`, `post-dotfiles`,
`pre-defaults`, `post-defaults`, `pre-user`, `post-user`, `pre-tools`, and
Expand Down
19 changes: 19 additions & 0 deletions docs/cli/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ Skip confirmation prompts

Overwrite existing files that conflict with whole-file dotfile entries

### `--skip… <SKIP>`

Skip one or more bootstrap parts

Can be passed multiple times or as a comma-separated list.

**Choices:**

- `packages`
- `dotfiles`
- `defaults`
- `launchd`
- `systemd`
- `user`
- `tools`
- `task`
- `final-hook`

### `--update`

Refresh system package manager metadata first (apk: `--update-cache`, apt: `apt-get update`)
Expand All @@ -65,6 +83,7 @@ Examples:
```
mise bootstrap # packages + dotfiles + tools + bootstrap task
mise bootstrap --force-dotfiles # replace conflicting dotfile targets
mise bootstrap --skip tools,task # skip tool installation and the bootstrap task
mise bootstrap packages install --yes
mise bootstrap macos-defaults status
mise bootstrap launchd apply --dry-run
Expand Down
75 changes: 75 additions & 0 deletions e2e/cli/test_bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,81 @@ assert_succeed "mise bootstrap --dry-run"
assert_directory_not_exists "$MISE_DATA_DIR/installs/tiny/2.1.0"
assert_fail "cat bootstrap_ran"

# --skip tools leaves configured tools uninstalled
cat <<EOF >mise.toml
[tools]
tiny = "2.2.0"

[tasks.bootstrap]
run = "touch bootstrap_ran"
EOF
rm -f bootstrap_ran
assert_succeed "mise bootstrap --yes --skip tools"
assert_directory_not_exists "$MISE_DATA_DIR/installs/tiny/2.2.0"
assert "test -f bootstrap_ran"

# comma-separated skips are supported
rm -f bootstrap_ran
cat <<EOF >mise.toml
[tools]
tiny = "2.3.0"

[tasks.bootstrap]
run = "touch bootstrap_ran"
EOF
assert_succeed "mise bootstrap --yes --skip tools,task"
assert_directory_not_exists "$MISE_DATA_DIR/installs/tiny/2.3.0"
assert_fail "test -f bootstrap_ran"

# repeated --skip flags are supported
echo "skipped gitconfig content" >gitconfig-skipped
rm -f bootstrap_ran
cat <<EOF >mise.toml
[dotfiles]
"~/.bootstrap-skip-gitconfig" = "gitconfig-skipped"

[tasks.bootstrap]
run = "touch bootstrap_ran"
EOF
assert_succeed "mise bootstrap --yes --skip dotfiles --skip task"
assert_fail "test -e ~/.bootstrap-skip-gitconfig"
assert_fail "test -f bootstrap_ran"

# --skip dotfiles still reloads config written by earlier phases
rm -f mise.local.toml config_task_ran
cat <<'EOF' >mise.toml
[bootstrap.hooks.post-packages]
run = 'printf "[tasks.bootstrap]\nrun = \"touch config_task_ran\"\n" > mise.local.toml'
EOF
assert_succeed "mise bootstrap --yes --skip dotfiles --skip tools"
assert "test -f config_task_ran"
rm -f mise.local.toml config_task_ran

# skipped parts also skip their directly associated hooks
rm -f pre_packages_hook post_packages_hook pre_tools_hook post_tools_hook final_hook
cat <<'EOF' >mise.toml
[bootstrap.hooks.pre-packages]
run = "touch pre_packages_hook"

[bootstrap.hooks.post-packages]
run = "touch post_packages_hook"

[bootstrap.hooks.pre-tools]
run = "touch pre_tools_hook"

[bootstrap.hooks.post-tools]
run = "touch post_tools_hook"

[bootstrap.hooks.final]
run = "touch final_hook"
EOF
assert_succeed "mise bootstrap --yes --skip packages --skip tools --skip final-hook"
assert_fail "test -f pre_packages_hook"
assert_fail "test -f post_packages_hook"
assert_fail "test -f pre_tools_hook"
assert_fail "test -f post_tools_hook"
assert_fail "test -f final_hook"

# macOS LaunchAgents in shared configs are inert when launchd is unavailable
cat <<EOF >mise.toml
[bootstrap.macos.launchd.agents.my-sync]
Expand Down
5 changes: 5 additions & 0 deletions man/man1/mise.1
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,11 @@ Skip confirmation prompts
\fB\-\-force\-dotfiles\fR
Overwrite existing files that conflict with whole\-file dotfile entries
.TP
\fB\-\-skip\fR \fI<SKIP>\fR
Skip one or more bootstrap parts

Can be passed multiple times or as a comma\-separated list.
.TP
\fB\-\-update\fR
Refresh system package manager metadata first (apk: `\-\-update\-cache`, apt: `apt\-get update`)
.SH "MISE BOOTSTRAP LAUNCHD APPLY"
Expand Down
11 changes: 11 additions & 0 deletions mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ Examples:

$ mise bootstrap # packages + dotfiles + tools + bootstrap task
$ mise bootstrap --force-dotfiles # replace conflicting dotfile targets
$ mise bootstrap --skip tools,task # skip tool installation and the bootstrap task
$ mise bootstrap packages install --yes
$ mise bootstrap macos-defaults status
$ mise bootstrap launchd apply --dry-run
Expand All @@ -327,6 +328,16 @@ Examples:
flag "-n --dry-run" help="Print what would happen without installing anything"
flag "-y --yes" help="Skip confirmation prompts"
flag --force-dotfiles help="Overwrite existing files that conflict with whole-file dotfile entries"
flag --skip help="Skip one or more bootstrap parts" var=#true {
long_help #"""
Skip one or more bootstrap parts

Can be passed multiple times or as a comma-separated list.
"""#
arg <SKIP> {
choices packages dotfiles defaults launchd systemd user tools task final-hook
}
}
flag --update help="Refresh system package manager metadata first (apk: `--update-cache`, apt: `apt-get update`)"
cmd launchd subcommand_required=#true help="Manage macOS LaunchAgents from `[bootstrap.macos.launchd.agents]`" {
cmd apply {
Expand Down
Loading
Loading