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

26 lines
1.0 KiB
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"
local tmp_git_command='git --git-dir=${HOME}/.dotfiles/ --work-tree=${HOME}'
if [[ -f ~/.ssh/noid_dotfiles ]]; then
repo_address="git@schlomp.space:tastytea/dotfiles.git"
export GIT_SSH_COMMAND="ssh -i ~/.ssh/noid_dotfiles"
tmp_git_command="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/noid_dotfiles\" ${tmp_git_command}"
fi
alias config="${tmp_git_command}"
git clone --bare ${repo_address} "${HOME}/.dotfiles" && \
config submodule init && \
config submodule update && \
config config --local status.showUntrackedFiles no && \
config config --local submodule.recurse true && \
print "Run \033[1;32mrm ${0} && ${tmp_git_command} checkout\033[0m" \
"to copy the files to your home directory."
# TODO: [remote "origin"] needs to have
# fetch = +refs/heads/*:refs/remotes/origin/* in order for
# submodule.recurse to work, but why?