setup.sh 702 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. #
  3. # Bootstrap chezmoi and apply the public dotfiles repository.
  4. #
  5. # Usage:
  6. # ./setup.sh
  7. #
  8. # Installs chezmoi if missing, then initializes and applies the public
  9. # dotfiles from git.beckesch.it:beckesch/dotfiles.git.
  10. set -euo pipefail
  11. readonly local_bin="${HOME}/.local/bin"
  12. readonly public_repo="git@git.beckesch.it:beckesch/dotfiles.git"
  13. # --
  14. # 1. Install chezmoi if missing
  15. # --
  16. if ! command -v chezmoi >/dev/null; then
  17. mkdir -p "$local_bin"
  18. /bin/sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$local_bin" init --apply "$public_repo"
  19. fi
  20. # --
  21. # 2. Init/apply the public dotfiles repo
  22. # --
  23. if ! chezmoi source-path >/dev/null 2>&1; then
  24. chezmoi init "$public_repo"
  25. fi
  26. chezmoi apply