From ea17070e5e68437cb55f3f0005125f06f3a4bf2f Mon Sep 17 00:00:00 2001 From: Mari Date: Wed, 25 Dec 2019 14:32:59 -0500 Subject: [PATCH] Add script to ease setup of new host. --- new-host.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 new-host.sh diff --git a/new-host.sh b/new-host.sh new file mode 100644 index 0000000..d39335c --- /dev/null +++ b/new-host.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [[ ! -d ~/.common-configs ]]; then + git clone git@github.com:programmablereya/common-configs.git ~/.common-configs + cd ~/.common-configs +else + cd ~/.common-configs + git pull +fi + +source ./bash_aliases.sh + +./install.sh + +if [[ ! -f ~/.ssh/id_ed25519.pub ]]; then + ssh-keygen + + ssh-authorize-key ~/.ssh/id_ed25519.pub + + echo "*** New keypair generated. Please add the new public key to github/bitbucket authorized keys:" + cat ~/.ssh/id_ed25519.pub + read -p "Press ENTER when done." +fi + +ORIGIN=$(git ls-remote --get-url origin) +if [[ "$ORIGIN" != 'git@github.com:programmablereya/common-configs.git' ]]; then + git remote set-url origin git@github.com:programmablereya/common-configs.git + + sync_git_only +fi