1
0
Fork 0
dotfiles/.local/bin/setup_dotfiles.sh

27 lines
805 B
Bash
Executable File

#!/bin/zsh
# Set up dotfiles on a new machine.
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
local repo_address="https://schlomp.space/tastytea/dotfiles.git"
alias config='git --git-dir=${HOME}/.dotfiles --work-tree=${HOME}'
local response
while [[ ! ${response} =~ '[yYnN]' ]]; do
print -n "use SSH? [y/n] "
read response
done
if [[ ${response[1]} =~ "[yY]" ]]; then
repo_address="git@schlomp.space:tastytea/dotfiles.git"
fi
git clone --bare ${repo_address} ${HOME}/.dotfiles
config config --local status.showUntrackedFiles no
config config --local core.worktree ${HOME}
config config core.bare false
print -P "%F{12}Run%f" \
"%F{13}rm ${0} &&" \
"git --git-dir=${HOME}/.dotfiles --work-tree=${HOME} checkout" \
"%F{12}to copy the files to your home directory.%f"