Replicate: Use PWD, fix dependency checks

This commit is contained in:
Salt 2018-08-20 15:20:07 -05:00
parent becbd2b639
commit 47b496ef58

View File

@ -1,16 +1,17 @@
#!/bin/sh #!/bin/sh
deps="git rsync" deps="git rsync"
for dep in $deps; do 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 printf "$0: error: could not find program \"$dep\" in PATH\n" 1>&2
exit 1 exit 1
fi fi
done done
tempfolder="/tmp/dots" tempfolder="/tmp/dots-`whoami`"
gitdir="$HOME/.dotfiles" gitdir="$PWD/.dotfiles"
homedir="$PWD"
repo='git@gitlab.com:rehashedsalt/home.git' 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" git clone --recursive --separate-git-dir="$gitdir" "$repo" "$tempfolder"
if ! $?; then if ! $?; then
@ -18,7 +19,7 @@ if ! $?; then
printf "Do you have the appropriate permissions? Does the remote host know your key?\n" printf "Do you have the appropriate permissions? Does the remote host know your key?\n"
exit 2 exit 2
fi fi
rsync -rvl --exclude ".git" $tempfolder/ $HOME/ rsync -rvl --exclude ".git" $tempfolder/ $homedir/
rm -r $tempfolder rm -r $tempfolder
$config submodule update --init --recursive --remote $config submodule update --init --recursive --remote
$config status.showUntrackedFiles no $config status.showUntrackedFiles no