From bacd4db2ef065d6418acfe61ac2fab8392341b7e Mon Sep 17 00:00:00 2001 From: Drew Short Date: Tue, 22 Sep 2015 17:20:45 -0500 Subject: [PATCH] Added an example ssh config... NO IDENTIFYING OR PERSONAL INFO. Just an example to use on systems where I don't already have one configured. --- home/.ssh/config | 8 ++++++++ scripts/bootstrap.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 home/.ssh/config diff --git a/home/.ssh/config b/home/.ssh/config new file mode 100644 index 0000000..56f621f --- /dev/null +++ b/home/.ssh/config @@ -0,0 +1,8 @@ +# example config file for SSH +# Sorry no secrets here ;P +#host sothr.com +# hostname example.host.name +# user example_user +# port example_port +# Protocol 2 +# IdentityFile example_identity_file diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 50975ec..faed101 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -22,6 +22,35 @@ link() { ln -sf "$3" "$1/$2" } +copy() { + # Only make a backup if an existing directory is there and is not a link + if [ -f "$1/$2" ] || [ -L "$1/$2" ]; then + # Allow passing true as third param to do backups + backup=true + if [ ! -z "$4" ]; then + backup=$4 + fi + overwrite=false + if [ ! -z "$5" ]; then + overwrite=$5 + fi + if $backup; then + mv "$1/$2" "$1/$2.old" + echo "Backed up original $2 to $1/$2.old" + else + if $overwrite; then + rm -r "$1/$2" + echo "removed original $2" + fi + fi + fi + # Should probably only do this is the source is newer + # Remove the old and copy the new + if $overwrite; then + cp -r "$3" "$1/$2" + fi +} + link_dir() { # Only make a backup if an existing directory is there and is not a link if [ -d "$1/$2" ] && [ ! -L "$1/$2" ]; then @@ -156,6 +185,9 @@ clone_git_repo $HOME/.tmux/plugins/tmux-resurrect https://github.com/tmux-plugin # Configure .tmux.conf link "$HOME" ".tmux.conf" "$DOTFILES_HOME/.tmux.conf" +# Copy example ssh config +copy "$HOME" ".ssh/config" "$DOTFILES_HOME/.ssh/config" false false + cd $GIT_DIR # Create an auto updater for the dotfiles