Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(cli): check if dotfiles install script is executable#8588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 15 commits intocoder:mainfromBRAVO68WEB:feat/dotfiles-exec
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
1d9c0f0
make dotfiles install scripts executable
BRAVO68WEBJul 19, 2023
3cb96f9
refactor: added better error handling
BRAVO68WEBJul 19, 2023
ca53d98
revert: prev installScriptSet
BRAVO68WEBJul 19, 2023
27c4e25
Merge branch 'coder:main' into feat/dotfiles-exec
BRAVO68WEBJul 19, 2023
ea1cb77
Update cli/dotfiles.go
BRAVO68WEBJul 20, 2023
245ec38
docs: added docs regarding usage of setup script in dotfiles
BRAVO68WEBJul 21, 2023
dfab224
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
32a9218
Update cli/dotfiles.go
BRAVO68WEBJul 21, 2023
5d9741d
Update cli/dotfiles.go
mafredriJul 21, 2023
95510a2
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
4900f44
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
b460751
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
ab300d5
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
b2bbaa4
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
b1a9a24
Update docs/dotfiles.md
BRAVO68WEBJul 21, 2023
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
12 changes: 12 additions & 0 deletionscli/dotfiles.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -193,6 +193,18 @@ func (r *RootCmd) dotfiles() *clibase.Cmd {
}

_, _ = fmt.Fprintf(inv.Stdout, "Running %s...\n", script)

// Check if the script is executable and notify on error
scriptPath := filepath.Join(dotfilesDir, script)
fi, err := os.Stat(scriptPath)
if err != nil {
return xerrors.Errorf("stat %s: %w", scriptPath, err)
}

if fi.Mode()&0o111 == 0 {
return xerrors.Errorf("script %q is not executable. See https://coder.com/docs/v2/latest/dotfiles for information on how to resolve the issue.", script)
}

// it is safe to use a variable command here because it's from
// a filtered list of pre-approved install scripts
// nolint:gosec
Expand Down
24 changes: 24 additions & 0 deletionsdocs/dotfiles.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,3 +60,27 @@ sudo apt update
# Install some of my favorite tools every time my workspace boots
sudo apt install -y neovim fish cargo
```

## Setup script support

User can setup their dotfiles by creating one of the following script files in their dotfiles repo:

- `install.sh`
- `install`
- `bootstrap.sh`
- `bootstrap`
- `script/bootstrap`
- `setup.sh`
- `setup`
- `script/setup`

If any of the above files are found (in the specified order), Coder will try to execute the first match. After the first match is found, other files will be ignored.

The setup script must be executable, otherwise the dotfiles setup will fail. If you encounter this issue, you can fix it by making the script executable using the following commands:

```shell
cd <path_to_dotfiles_repo>
chmod +x <script_name>
git commit -m "Make <script_name> executable" <script_name>
git push
```

[8]ページ先頭

©2009-2025 Movatter.jp