diff --git a/functions.sh b/functions.sh index 6f6dacf..3b2a602 100644 --- a/functions.sh +++ b/functions.sh @@ -45,8 +45,8 @@ fi # downloaded and run. This is helpful when bootstrapping, as the dotfiles repo # may not be cloned yet. function run_script() { - if test -f "$(dirname "$0")/$1"; then - sh $(dirname "$0")/$1 + if test -f "$(chezmoi source-path)/$1"; then + sh $(chezmoi source-path "$0")/$1 else sh -c "$($curl $cdn/$1)" fi diff --git a/run_once_generate_ssh_key.sh b/run_once_generate_ssh_key.sh index 60eea38..b8759ee 100644 --- a/run_once_generate_ssh_key.sh +++ b/run_once_generate_ssh_key.sh @@ -17,7 +17,7 @@ if [[ ! -f $HOME/.ssh/id_rsa ]]; then ssh-keygen -f $sshkey -N "" fi -run_script run_once_install_gh.sh +run_script $0 run_once_install_gh.sh if ! gh auth status 1>/dev/null 2>/dev/null; then gh auth login --git-protocol ssh --hostname github.com --web fi diff --git a/run_once_install_gh.sh b/run_once_install_gh.sh index 39a55ad..1ae4663 100644 --- a/run_once_install_gh.sh +++ b/run_once_install_gh.sh @@ -10,6 +10,6 @@ test -f $0/$f && . $0/$f || . <($curl -fsSL $cdn/$f) if ! gh --version 1>/dev/null 2>/dev/null; then # Install Homebrew - run_script run_once_install_homebrew.sh + run_script $0 run_once_install_homebrew.sh $brewinstall gh fi