Update bootstrap-macOS.sh (untested)
This commit is contained in:
parent
dd1c8e09e8
commit
2dea6fce1f
12
README.md
12
README.md
@ -4,12 +4,6 @@ Bootstrap an OS instance with bare essentials.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To bootstrap a macOS instance:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -O https://git.infektor.net/config/bootstrap/raw/main/bootstrap-macOS.sh && chmod +x bootstrap-macOS.sh && ./bootstrap-macOS.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
To bootstrap a Linux instance choose one of:
|
To bootstrap a Linux instance choose one of:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -25,3 +19,9 @@ To bootstrap a Windows instance:
|
|||||||
```powershell
|
```powershell
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -Uri "https://git.infektor.net/config/bootstrap/raw/main/bootstrap-Windows.ps1" -OutFile "./bootstrap-Windows.ps1"; ./bootstrap-Windows.ps1
|
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -Uri "https://git.infektor.net/config/bootstrap/raw/main/bootstrap-Windows.ps1" -OutFile "./bootstrap-Windows.ps1"; ./bootstrap-Windows.ps1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To bootstrap a macOS instance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -O https://git.infektor.net/config/bootstrap/raw/main/bootstrap-macOS.sh && chmod +x bootstrap-macOS.sh && ./bootstrap-macOS.sh
|
||||||
|
```
|
||||||
|
@ -11,16 +11,13 @@ show_help() {
|
|||||||
echo
|
echo
|
||||||
echo "Bootstrap a macOS instance with:"
|
echo "Bootstrap a macOS instance with:"
|
||||||
echo
|
echo
|
||||||
echo "* Xcode command line developer tools"
|
echo "* Install xcode command line developer tools"
|
||||||
echo "* Homebrew - package manager"
|
echo "* Install homebrew"
|
||||||
echo "* python - from Homebrew"
|
echo "* Update packages"
|
||||||
echo "* virtualenv - from pip"
|
echo "* Install python, pip"
|
||||||
echo "* SSH key - from ssh-keygen"
|
echo "* Install ansible"
|
||||||
echo "* GitHub public key - with SSH key"
|
echo "* Clone configuration repository"
|
||||||
echo "* GitLab public key - with SSH key"
|
echo "* Install 1password"
|
||||||
echo "* BitBucket Cloud public key - with SSH key"
|
|
||||||
echo "* Gogs Cloud public key - with SSH key"
|
|
||||||
echo "* conduit - configuration manager"
|
|
||||||
echo
|
echo
|
||||||
echo "If any already exist they will not be reinstalled."
|
echo "If any already exist they will not be reinstalled."
|
||||||
echo
|
echo
|
||||||
@ -56,14 +53,6 @@ agree() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
brew_install() {
|
|
||||||
brew install $1 > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
pip_install() {
|
|
||||||
pip install --user $1 > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
export PATH=~/.local/bin:$PATH
|
export PATH=~/.local/bin:$PATH
|
||||||
export PYTHONUSERBASE=~/.local
|
export PYTHONUSERBASE=~/.local
|
||||||
|
|
||||||
@ -71,40 +60,23 @@ if ! xcode-select --print-path &> /dev/null; then
|
|||||||
agree "Install Xcode command line developer tools" && xcode-select --install
|
agree "Install Xcode command line developer tools" && xcode-select --install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
missing brew && agree "Intalll Homebrew" && /usr/bin/ruby -e \
|
missing brew && agree "Install homebrew" && /usr/bin/ruby -e \
|
||||||
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||||
|
|
||||||
agree "Update Homebrew packages" && brew update > /dev/null
|
agree "Update homebrew packages" && brew update
|
||||||
|
brew install python
|
||||||
|
|
||||||
if missing /usr/local/bin/python2 && agree "Install Homebrew python"; then
|
# TODO: Update PATH for pip?
|
||||||
brew_install python
|
|
||||||
export PATH=/usr/local/opt/python/libexec/bin:$PATH
|
echo "Install ansible"
|
||||||
echo "To use Homebrew python update your PATH:"
|
pip install --user --break-system-packages ansible jmespath
|
||||||
echo 'export PATH=/usr/local/opt/python/libexec/bin:$PATH'
|
|
||||||
|
if [ ! -d ~/.config/local ]; then
|
||||||
|
echo "Clone configuration repository"
|
||||||
|
git clone https://git.infektor.net/config/local.git ~/.config/local
|
||||||
fi
|
fi
|
||||||
|
|
||||||
missing virtualenv && agree "Install virtualenv" && pip_install virtualenv
|
agree "Install 1password" && \
|
||||||
|
~/.local/bin/ansible-playbook ~/.config/local/playbooks/1password.yaml
|
||||||
if [ ! -f ~/.ssh/id_rsa ] && agree "Generate SSH key"; then
|
|
||||||
read -rp "SSH email: " email
|
|
||||||
[ ! -d ~/.ssh ] && mkdir -p ~/.ssh
|
|
||||||
ssh-keygen -t rsa -b 4096 -C "$email" -N "" -f ~/.ssh/id_rsa
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! missing virtualenv && agree "Set SSH keys on remote Git servers"; then
|
|
||||||
env=$(mktemp -d)
|
|
||||||
virtualenv $env &> /dev/null
|
|
||||||
source $env/bin/activate
|
|
||||||
pip install git+https://code.infektor.net/config/bootstrap.git > /dev/null
|
|
||||||
python -c 'import bootstrap; bootstrap.set_ssh_keys()'
|
|
||||||
deactivate
|
|
||||||
rm -r $env
|
|
||||||
fi
|
|
||||||
|
|
||||||
! missing pip && missing conduit && agree "Install conduit" && \
|
|
||||||
pip_install git+ssh://git@github.com/kbenzie/conduit.git
|
|
||||||
|
|
||||||
echo "To use installed pip packages update your PATH and PYTHONUSERBASE:"
|
|
||||||
echo 'export PATH=~/.local/bin:$PATH && export PYTHONUSERBASE=~/.local'
|
|
||||||
|
|
||||||
[ -f $0 ] && agree "Remove $0" "N" && rm $0 || exit 0
|
[ -f $0 ] && agree "Remove $0" "N" && rm $0 || exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user