Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of bootstrap that can be used to run other scripts #476

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

plandem
Copy link

@plandem plandem commented Dec 21, 2023

What does this PR do?

Save this file as ~/.config/yadm/bootstrap and make it executable. It expects
environment variable file with a name of shell script to execute. file can be relative to ~/.config/yadm/ or has full
path.

It also adds some helpers (e.g. install, confirm, command_exists, source_if_exists ) that can be used in sourced files.

Usage:

file=install yadm bootstrap

or

file=~/.config/yadm/install yadm bootstrap

where ~/.config/yadm/install can be like this:

[[ ! $(type -t install) = 'function' ]] && echo "Usage: file=$(basename "$0") yadm bootstrap" && exit 1

confirm yes 'softwareupdate --agree-to-license --install --all' "$(info 'Install ' warning 'OSX updates')"
install 'brew' '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'

brew bundle --global

What issues does this PR fix or reference?

[A list of related issues / pull requests.]

Previous Behavior

New Behavior

Have tests been written for this change?

No

Have these commits been signed with GnuPG?

Yes


Please review yadm's Contributing Guide for best practices.

Add example of bootstrap that can be used to run interactive shell scripts
and also expecting `file` instead of `source` as env. variable to make that possible without dancing around: 
```
#!/bin/bash

file=backup && yadm bootstrap;
file=install && yadm bootstrap;
file=configure &&yadm bootstrap;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants