From 47b496ef58333bcd85d507b8f02e873bd5233c88 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Mon, 20 Aug 2018 15:20:07 -0500
Subject: [PATCH] Replicate: Use PWD, fix dependency checks

---
 bootstrap/replicate.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bootstrap/replicate.sh b/bootstrap/replicate.sh
index 79ca4b8..8f0beb7 100755
--- a/bootstrap/replicate.sh
+++ b/bootstrap/replicate.sh
@@ -1,16 +1,17 @@
 #!/bin/sh
 deps="git rsync"
 for dep in $deps; do
-	if ! [ "`which $dep > /dev/null 2>&1`" ]; then
+	if ! which $dep > /dev/null 2>&1; then
 		printf "$0: error: could not find program \"$dep\" in PATH\n" 1>&2
 		exit 1
 	fi
 done
 
-tempfolder="/tmp/dots"
-gitdir="$HOME/.dotfiles"
+tempfolder="/tmp/dots-`whoami`"
+gitdir="$PWD/.dotfiles"
+homedir="$PWD"
 repo='git@gitlab.com:rehashedsalt/home.git'
-config='git --git-dir="$gitdir" --work-tree="$HOME"'
+config='git --git-dir="$gitdir" --work-tree="$homedir"'
 
 git clone --recursive --separate-git-dir="$gitdir" "$repo" "$tempfolder"
 if ! $?; then
@@ -18,7 +19,7 @@ if ! $?; then
 	printf "Do you have the appropriate permissions? Does the remote host know your key?\n"
 	exit 2
 fi
-rsync -rvl --exclude ".git" $tempfolder/ $HOME/
+rsync -rvl --exclude ".git" $tempfolder/ $homedir/
 rm -r $tempfolder
 $config submodule update --init --recursive --remote
 $config status.showUntrackedFiles no