Make skeleton directories, update README, and fix repo config

This commit is contained in:
Salt 2018-08-24 17:50:58 -05:00
parent f3610f296e
commit 4986c241ed
2 changed files with 7 additions and 6 deletions

View File

@ -11,4 +11,4 @@ Download and run the latest `replicate.sh`:
## Notes
* The script assumes that you want to bootstrap `$PWD` as `$HOME`. Don't run it out of your Downloads folder.
* By default, the repository will attempt to clone with SSH. Either generate those keys and add them to GitLab or change the repository URI to HTTP.
* Ideally, this will be called via Ansible or some other automation tool. It may, in the future, contain specific code for this purpose.

View File

@ -1,4 +1,5 @@
#!/bin/sh
name="$(basename "$0")"
deps="git rsync"
for dep in $deps; do
if ! which $dep > /dev/null 2>&1; then
@ -6,25 +7,25 @@ for dep in $deps; do
exit 1
fi
done
mkdir Desktop Documents Downloads Games Music Pictures Projects System Videos
tempfolder="/tmp/dots-`whoami`"
gitdir="$PWD/.dotfiles"
homedir="$PWD"
repo='git@gitlab.com:rehashedsalt/home.git'
config='git --git-dir="$gitdir" --work-tree="$homedir"'
git clone --recursive --depth 100 --separate-git-dir="$gitdir" "$repo" "$tempfolder"
error="$?"
if ! [ "$error" == "0" ]; then
printf "$0: error: failed cloning repository \"$repo\": $error\n" 1>&2
printf "$name: error: failed cloning repository \"$repo\": $error\n" 1>&2
printf "Do you have the appropriate permissions? Does the remote host know your key?\n"
exit 2
fi
rsync -rvl --exclude ".git" $tempfolder/ $homedir/
rm -r $tempfolder
$config submodule update --init --recursive --remote
$config config status.showUntrackedFiles no
printf "$0: dotfiles set up successfully\n"
git --git-dir="$gitdir" --work-tree="$homedir" submodule update --init --recursive --remote
git --git-dir="$gitdir" --work-tree="$homedir" config status.showUntrackedFiles no
printf "$name: 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"