#!/usr/bin/env bash set -euo pipefail repository_url="https://github.com/tanacchi/dotfiles.git" dotfiles_dir="${HOME}/dotfiles" if ! command -v git >/dev/null 2>&1; then echo "git is required before installing dotfiles." >&2 exit 1 fi if ! command -v python3 >/dev/null 2>&1; then echo "python3 is required before installing dotfiles." >&2 exit 1 fi if [ -d "${dotfiles_dir}/.git" ]; then git -C "${dotfiles_dir}" pull --ff-only elif [ -e "${dotfiles_dir}" ]; then mv "${dotfiles_dir}" "${dotfiles_dir}.backup.$(date +%Y%m%d%H%M%S)" git clone "${repository_url}" "${dotfiles_dir}" else git clone "${repository_url}" "${dotfiles_dir}" fi python3 "${dotfiles_dir}/scripts/setup/install.py" --install-mise --install-tools