From e4b1fc02db2f2329087c2bc5f4753de146a5f4f5 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 5 Apr 2018 19:12:45 +0200 Subject: [PATCH] Add setup script --- README.md | 16 +++++++--------- bin/setup.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) create mode 100755 bin/setup.sh diff --git a/README.md b/README.md index 431d1d2..c65d4cf 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ -# Getting started +# Installation -1. Install [rcm](https://github.com/thoughtbot/rcm#installation): +Install using: ```bash - sudo add-apt-repository ppa:martin-frost/thoughtbot-rcm - sudo apt-get update - sudo apt-get install rcm + cd $HOME && \ + git clone git@git.schauenburg.me:fernando/dotfiles.git .dotfiles && \ + .dotfiles/bin/setup.sh ``` -2. Install the dotfiles: +Installation of the dotfiles is handled automatically from `setup.sh` via +[rcm](https://github.com/thoughtbot/rcm#installation). - ```bash - env RCRC=$HOME/.dotfiles/rcrc rcup - ``` diff --git a/bin/setup.sh b/bin/setup.sh new file mode 100755 index 0000000..b3eb842 --- /dev/null +++ b/bin/setup.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +# Install RCM +if ! command -v rcup >/dev/null 2>&1 +then + case "$(uname -s)" in + Linux*) + sudo add-apt-repository -y ppa:martin-frost/thoughtbot-rcm && \ + apt-get update && \ + apt-get install -y rcm + ;; + + Darwin*) + brew tap thoughtbot/formulae + brew install rcm + ;; + + CYGWIN*) + curl -LO https://thoughtbot.github.io/rcm/dist/rcm-1.3.1.tar.gz && \ + sha=$(sha256 rcm-1.3.1.tar.gz | cut -f1 -d' ') && \ + [ "$sha" = "9c8f92dba63ab9cb8a6b3d0ccf7ed8edf3f0fb388b044584d74778145fae7f8f" ] && \ + tar -xvf rcm-1.3.1.tar.gz && \ + cd rcm-1.3.1 && \ + ./configure --prefix=/usr/local && make && sudo make install + ;; + *) + echo "Platform not supported" + exit 1 + ;; + esac +fi + +# Use RCM to install dotfiles +env RCRC=$(realpath "${BASH_SOURCE%/*}/../rcrc") rcup -v +