From 14b7eb9beee838cee9fca653e93f0589d325fc72 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sun, 13 Jan 2019 17:15:41 +0000 Subject: [PATCH] Add a basic, one-time initialisation script for dotfiles --- bin/dotfiles-init | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 bin/dotfiles-init diff --git a/bin/dotfiles-init b/bin/dotfiles-init new file mode 100755 index 0000000..72d0d62 --- /dev/null +++ b/bin/dotfiles-init @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -e + +OS=$(uname -s | tr A-Z a-z) + +if [ -d ~/dotfiles ]; then + echo "[DOTFILES] Detected: moving to correct location" + mv -nv ~/dotfiles/* ~ + mv -nv ~/dotfiles/.* ~ + rmdir ~/dotfiles +fi + +if [ -x "$(which vim)" -a -e ~/.vim/bundle ]; then + echo "[VIM] Detected: initialising Vim bundle" + git submodule init + git submodule update + + echo "[VIM] Upgrading plugins" + ~/bin/vim-upgrade +fi + +if [ -x "$(which ansible)" -a -f ~/.ansible/${OS}_galaxy.yaml ]; then + echo "[ANSIBLE] Detected: initialising Galaxy dependencies" + ansible-galaxy install -r ~/.ansible/${OS}_galaxy.yaml + echo "[ANSIBLE] Running desktop installation and configuration" + ansible-playbook ~/.ansible/desktop.yaml -K +fi