diff --git a/README.md b/README.md index fc06ebb..73ca263 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,15 @@ Thanks for visiting, the `exit` is that way! Designed for macOS, kinda works on Linux (requires [ZSH to be installed](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#ubuntu-debian--derivatives-windows-10-wsl--native-linux-kernel-with-windows-10-build-1903) first): ```bash -git clone https://github.com/jakejarvis/dotfiles.git ~/.dotfiles -~/.dotfiles/install.sh +git clone --recurse-submodules https://github.com/jakejarvis/dotfiles.git ~/.dotfiles +cd ~/.dotfiles +bash install.sh +``` + +or: + +```bash +curl -sL jrvs.io/bootstrap | bash # probably don't do this if you're not me ``` ## License diff --git a/install.sh b/install.sh index bcf9a2d..d2063db 100755 --- a/install.sh +++ b/install.sh @@ -1,16 +1,24 @@ #!/usr/bin/env bash +set -euo pipefail + +# what a mess. https://stackoverflow.com/a/53183593 +YOU_ARE_HERE="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" + echo "👋 Deep breaths, everything will (probably) be fine!" # Ask for the administrator password upfront sudo -v +# Clone this repo if we haven't already +git clone --recurse-submodules https://github.com/jakejarvis/dotfiles.git "$YOU_ARE_HERE" || true + # Set up symbolic links for ZSH and Git pointing to this cloned repo -ln -sf ~/.dotfiles/zsh/.zshrc ~/.zshrc -ln -sf ~/.dotfiles/git/.gitconfig ~/.gitconfig -ln -sf ~/.dotfiles/git/.gitignore_global ~/.gitignore_global +ln -sf "$YOU_ARE_HERE/zsh/.zshrc" ~/.zshrc +ln -sf "$YOU_ARE_HERE/git/.gitconfig" ~/.gitconfig +ln -sf "$YOU_ARE_HERE/git/.gitignore_global" ~/.gitignore_global mkdir -p ~/.ssh -ln -sf ~/.dotfiles/ssh/.ssh/config ~/.ssh/config +ln -sf "$YOU_ARE_HERE/ssh/.ssh/config" ~/.ssh/config # Suppress terminal login banners touch ~/.hushlogin @@ -28,8 +36,8 @@ fi git submodule update --init --recursive if [ "$(uname)" == "Darwin" ]; then - # shellcheck disable=SC1091 - source ./macos/macos.sh + # shellcheck disable=SC1090,SC1091 + source "$YOU_ARE_HERE/macos/macos.sh" else echo "" echo "This isn't a Mac, so we're all done here!" diff --git a/macos/defaults.sh b/macos/defaults.sh index ddbfe6c..9ee4359 100755 --- a/macos/defaults.sh +++ b/macos/defaults.sh @@ -6,6 +6,8 @@ # https://github.com/paulirish/dotfiles/blob/master/.osx # https://github.com/kevinSuttle/macOS-Defaults/blob/master/.macos +set -euo pipefail + # Change new hostname here if necessary COMPUTER_NAME="JJ-MBA" diff --git a/macos/macos.sh b/macos/macos.sh index d4465c9..6770263 100755 --- a/macos/macos.sh +++ b/macos/macos.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euo pipefail + # This shouldn't be run if not on macOS, but make double sure if test ! "$(uname)" = "Darwin"; then exit 0