diff --git a/Makefile b/Makefile deleted file mode 100644 index 74d4c70..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -EXCLUDE := .DS_Store .git .gitmodules .gitignore -DOTFILES := $(filter-out $(EXCLUDE), $(wildcard .??*)) - -all: install - -help: - @echo "make list #=> Show dot files in this repo" - @echo "make deploy #=> Create symlink to home directory" - @echo "make update #=> Fetch changes for this repo" - @echo "make install #=> Run make update, deploy, init" - -list: - @$(foreach val, $(DOTFILES), /bin/ls -dF $(val);) - -deploy: - @echo '==> Start to deploy dotfiles to home directory.' - @echo '' - @$(foreach val, $(DOTFILES), ln -sfnv $(abspath $(val)) $(HOME)/$(val);) - -update: - git pull origin master - git submodule init - git submodule update - git submodule foreach git pull origin master - -install: update deploy - @exec $$SHELL \ No newline at end of file diff --git a/README.md b/README.md index 0982123..69c0d7e 100644 --- a/README.md +++ b/README.md @@ -14,15 +14,17 @@ My color scheme is [Smyck Color Scheme by hukl](https://github.com/hukl/Smyck-Co The repo ships with a Makefile that you can use to deploy and update the dotfiles. - # make help + # bootstrap.sh help - make list #=> Show dot files in this repo - make deploy #=> Create symlink to home directory - make update #=> Fetch changes for this repo - make install #=> Run make update, deploy, init - make clean #=> Remove the dot files and this repo + Usage: bootstrap.sh command {params} -The dotfiles will be symlinked to your **~**. + list List all files that will be copied + update Update the git repo and the included submodules + deploy Copy the files to ~ + install Update and deploy these dotfiles + help Show this screen + +The dotfiles will be copied to your **~**. ## Installation @@ -32,15 +34,14 @@ The dotfiles will be symlinked to your **~**. 2. Deploy - make install + ./bootstrap.sh install 3. Enjoy! -If you want to update to the newest version, run ``make update`` from within the dotfiles folder. +If you want to update to the newest version, run ``bootstrap.sh update`` from within the dotfiles folder and ``bootstrap.sh deploy`` to copy the updated files. ## Credits - dotfiles based on [dotfiles by hukl](https://github.com/hukl/dotfiles) -- Makefile based on [Makefile by b4b4r07](https://github.com/b4b4r07/dotfiles/blob/master/Makefile) - [Git prompt by Josh Dick](https://gist.github.com/joshdick/4415470) \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..6fcf3f9 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env sh + +# bootstrap.sh +# Copyright 2016 Christian Busch +# http://github.com/chrisb86/dotfiles + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI + +exclude="README.md|init|Makefile|screenshot.png|.git|.gitignore|.gitmodules|.DS_Store|bootstrap.sh" + +bootstrap=`basename -- $0` + +# Show help screen +# Usage: help exitcode +help () { + echo "Usage: $bootstrap command {params}" + echo + echo "list List all files that will be copied" + echo "update Update the git repo and the included submodules" + echo "deploy Copy the files to ~" + echo "install Update and deploy these dotfiles" + echo "help Show this screen" + + exit $1 +} + +# Update git repo and submodules +# Usage: df_update +df_update () { + git pull origin master + git submodule init + git submodule update + git submodule foreach git pull origin master +} + +# Deploy files to ~ +# Usage: df_deploy +df_deploy () { + # poor man's rsync + df_list | cpio -pdmB --quiet ~ +} + +# List files that will be copied +# Usage: df_list +df_list () { + find . -print | grep -vE "$exclude" +} + +case "$1" in +######################## bootstrap.sh HELP ######################## +help) + help 0 + ;; +######################## bootstrap.sh LIST ######################## +list) + ## Lists all files in repo, except those specified in $exclude" + df_list + ;; +######################## bootstrap.sh DEPLOY ######################## +deploy) + echo "#### Copying files to ~" + + # Copy color vim scheme from init folder to .vim/colors + cp init/Smyck-Color-Scheme/smyck.vim .vim/colors/smyck.vim + + df_deploy + ;; +######################## bootstrap.sh UPDATE ######################## +update) + echo "#### Updating git repos and submodules" + df_update + ;; +######################## bootstrap.sh INSTALL ######################## +install) + echo "#### Updating git repos and submodules" + df_update + + echo "#### Copying files to ~" + df_deploy + ;; + *) + help 1 + ;; +esac \ No newline at end of file