From 4986c241ed275c33dea5b11cf9456708bdb04703 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 24 Aug 2018 17:50:58 -0500 Subject: [PATCH] Make skeleton directories, update README, and fix repo config --- README.md | 2 +- replicate.sh | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 26cee07..9c08cd0 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/replicate.sh b/replicate.sh index 14e6518..891be5f 100755 --- a/replicate.sh +++ b/replicate.sh @@ -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"