2018-07-14 14:35:26 -05:00
|
|
|
#!/bin/sh
|
2018-08-12 19:17:25 -05:00
|
|
|
deps="git rsync"
|
|
|
|
for dep in $deps; do
|
2018-08-20 15:20:07 -05:00
|
|
|
if ! which $dep > /dev/null 2>&1; then
|
2018-08-12 19:17:25 -05:00
|
|
|
printf "$0: error: could not find program \"$dep\" in PATH\n" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-08-20 15:20:07 -05:00
|
|
|
tempfolder="/tmp/dots-`whoami`"
|
|
|
|
gitdir="$PWD/.dotfiles"
|
|
|
|
homedir="$PWD"
|
2018-08-12 19:17:25 -05:00
|
|
|
repo='git@gitlab.com:rehashedsalt/home.git'
|
2018-08-20 15:20:07 -05:00
|
|
|
config='git --git-dir="$gitdir" --work-tree="$homedir"'
|
2018-08-12 19:17:25 -05:00
|
|
|
|
|
|
|
git clone --recursive --separate-git-dir="$gitdir" "$repo" "$tempfolder"
|
2018-08-16 21:53:16 -05:00
|
|
|
if ! $?; then
|
2018-08-12 19:17:25 -05:00
|
|
|
printf "$0: error: failed cloning repository \"$repo\"\n" 1>&2
|
|
|
|
printf "Do you have the appropriate permissions? Does the remote host know your key?\n"
|
|
|
|
exit 2
|
|
|
|
fi
|
2018-08-20 15:20:07 -05:00
|
|
|
rsync -rvl --exclude ".git" $tempfolder/ $homedir/
|
2018-02-03 00:34:17 -06:00
|
|
|
rm -r $tempfolder
|
2018-08-12 19:17:25 -05:00
|
|
|
$config submodule update --init --recursive --remote
|
|
|
|
$config status.showUntrackedFiles no
|
|
|
|
printf "$0: dotfiles set up successfully\n"
|
|
|
|
printf "Be sure and configure the following before issuing any commits:\n"
|
|
|
|
printf " git config --global user.email\n"
|
|
|
|
printf " git config --global user.name\n"
|
|
|
|
exit 0
|