From 7560bbc0fb96ed80a76f505a4f6ab64a26ecd94e Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 15 Apr 2022 14:11:00 +0200 Subject: [PATCH] Update dotfile repo setup script --- .local/bin/setup_dotfiles.sh | 25 +++++++++++++++++++++++++ bin/setup_dotfiles.sh | 20 -------------------- 2 files changed, 25 insertions(+), 20 deletions(-) create mode 100755 .local/bin/setup_dotfiles.sh delete mode 100755 bin/setup_dotfiles.sh diff --git a/.local/bin/setup_dotfiles.sh b/.local/bin/setup_dotfiles.sh new file mode 100755 index 0000000..90025a9 --- /dev/null +++ b/.local/bin/setup_dotfiles.sh @@ -0,0 +1,25 @@ +#!/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? diff --git a/bin/setup_dotfiles.sh b/bin/setup_dotfiles.sh deleted file mode 100755 index 6edfa60..0000000 --- a/bin/setup_dotfiles.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/zsh - -_tmp_config_alias='git --git-dir=${HOME}/.dotfiles/ --work-tree=${HOME}' -if [[ -f ~/.ssh/noid_dotfiles ]]; then - export GIT_SSH_COMMAND="ssh -i ~/.ssh/noid_dotfiles" - _tmp_config_alias="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/noid_dotfiles\" ${_tmp_config_alias}" -fi -alias config="${_tmp_config_alias}" - -git clone --bare git@schlomp.space:tastytea/dotfiles.git "${HOME}/.dotfiles" && \ - config submodule init && \ - config submodule update && \ - config config --local status.showUntrackedFiles no && \ - config config --local submodule.recurse true && \ - echo -e "Run \033[1;32mrm ${0} && ${_tmp_config_alias} checkout\033[0m to copy the files to your home directory." -unset tmp_alias_config - -# TODO: [remote "origin"] needs to have -# fetch = +refs/heads/*:refs/remotes/origin/* in order for -# submodule.recurse to work, but why?