aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-03-02 00:21:56 +1300
committerTom Ryder <tom@sanctum.geek.nz>2014-03-02 00:21:56 +1300
commit8e4185c725852935944a74453c2ebc1de26f4f06 (patch)
tree4ec4150e1807e35cd84d246ad7dd06fc58752f21
parentSimplify some command existence checks (diff)
downloaddotfiles-8e4185c725852935944a74453c2ebc1de26f4f06.tar.gz
dotfiles-8e4185c725852935944a74453c2ebc1de26f4f06.zip
Using Makefile-based install system
Just in an effort to use the right tool for the job. The new Makefile also makes more of an effort to remove and symlink files rather than whole directories, which means I shouldn't need stupid stuff in .gitignore anymore, so that's gone too.
-rw-r--r--.gitignore12
-rw-r--r--Makefile117
-rw-r--r--README.markdown43
-rwxr-xr-xinstall162
4 files changed, 136 insertions, 198 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 5ef48157..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-gnupg/*
-!gnupg/*.conf
-mutt/muttrc.local
-mutt/signature
-newsbeuter/urls
-ncmpcpp/*.log
-urxvt/urxvtd-*
-vim/.netrwhist
-vim/spell/*
-vim/backup/*
-vim/swap/*
-vim/undo/*
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..4f69c1c6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,117 @@
+install : install-ack \
+ install-bash \
+ install-curl \
+ install-git \
+ install-gnupg \
+ install-readline \
+ install-sh \
+ install-terminfo \
+ install-vim
+
+install-ack :
+ mkdir -p $(HOME)/.local/bin
+ rm -fr $(HOME)/.local/bin/ack $(HOME)/.ackrc
+ ln -s $(PWD)/ack/ack $(HOME)/.local/bin/ack
+ ln -s $(PWD)/ack/ackrc $(HOME)/.ackrc
+
+install-bash :
+ mkdir -p $(HOME)/.config
+ rm -f $(HOME)/.bashrc $(HOME)/.bash_profile \
+ $(HOME)/.bash_logout $(HOME)/.config/bash_completion
+ rm -fr $(HOME)/.bashrc.d
+ ln -s $(PWD)/bash/bashrc $(HOME)/.bashrc
+ ln -s $(PWD)/bash/bashrc.d $(HOME)/.bashrc.d
+ ln -s $(PWD)/bash/bash_profile $(HOME)/.bash_profile
+ ln -s $(PWD)/bash/bash_logout $(HOME)/.bash_logout
+ ln -s $(PWD)/bash/bash_completion $(HOME)/.config/bash_completion
+
+install-curl :
+ rm -f $(HOME)/.curlrc
+ ln -s $(PWD)/curl/curlrc $(HOME)/.curlrc
+
+install-git :
+ rm -f $(HOME)/.gitconfig
+ ln -s $(PWD)/git/gitconfig $(HOME)/.gitconfig
+
+install-gnupg :
+ mkdir -p $(HOME)/.gnupg
+ rm -f $(HOME)/.gnupg/gpg.conf $(HOME)/.gnupg/gpg-agent.conf
+ ln -s $(PWD)/gnupg/gpg.conf $(HOME)/.gnupg/gpg.conf
+ ln -s $(PWD)/gnupg/gpg-agent.conf $(HOME)/.gnupg/gpg-agent.conf
+
+install-i3 :
+ mkdir -p $(HOME)/.i3
+ rm -f $(HOME)/.i3/config $(HOME)/.i3/status $(HOME)/.i3/draugen.jpg
+ ln -s $(PWD)/i3/config $(HOME)/.i3/config
+ ln -s $(PWD)/i3/status $(HOME)/.i3/status
+ ln -s $(PWD)/i3/draugen.jpg $(HOME)/.i3/draugen.jpg
+
+install-mutt :
+ mkdir -p $(HOME)/.mutt $(HOME)/.cache/mutt
+ mkdir -p $(HOME)/Mail/inbox/cur \
+ $(HOME)/Mail/inbox/new \
+ $(HOME)/Mail/inbox/tmp
+ mkdir -p $(HOME)/Mail/sent/cur \
+ $(HOME)/Mail/sent/new \
+ $(HOME)/Mail/sent/tmp
+ rm -f $(HOME)/.muttrc
+ ln -s $(PWD)/mutt/muttrc $(HOME)/.muttrc
+ touch $(HOME)/.mutt/muttrc.local $(HOME)/.mutt/signature
+
+install-ncmcpp :
+ mkdir -p $(HOME)/.ncmpcpp
+ rm -f $(HOME)/.ncmpcpp/config
+ ln -s $(PWD)/ncmpcpp/config $(HOME)/.ncmpcpp/config
+
+install-newsbeuter :
+ mkdir -p $(HOME)/.config/newsbeuter $(HOME)/.local/share/newsbeuter
+ rm -f $(HOME)/.config/newsbeuter/config
+ ln -s $(PWD)/newsbeuter/config $(HOME)/.config/newsbeuter/config
+
+install-mysql :
+ rm -f $(HOME)/.my.cnf
+ ln -s $(PWD)/mysql/my.cnf $(HOME)/.my.cnf
+
+install-psql :
+ rm -f $(HOME)/.psqlrc
+ ln -s $(PWD)/psql/psqlrc $(HOME)/.psqlrc
+
+install-readline :
+ rm -f $(HOME)/.inputrc
+ ln -s $(PWD)/readline/inputrc $(HOME)/.inputrc
+
+install-sh :
+ rm -f $(HOME)/.profile
+ rm -fr $(HOME)/.profile.d
+ ln -s $(PWD)/sh/profile $(HOME)/.profile
+ ln -s $(PWD)/sh/profile.d $(HOME)/.profile.d
+
+install-terminfo :
+ for info in $(PWD)/terminfo/*.info ; do tic "$$info" ; done
+
+install-tmux :
+ rm -f $(HOME)/.tmux.conf
+ ln -s $(PWD)/tmux/tmux.conf $(HOME)/.tmux.conf
+
+install-vim :
+ (cd $(PWD) && git submodule update --init)
+ rm -fr $(HOME)/.vim/after $(HOME)/.vim/autoload $(HOME)/.vim/bundle
+ rm -f $(HOME)/.vimrc $(HOME)/.gvimrc
+ ln -s $(PWD)/vim/after $(HOME)/.vim/after
+ ln -s $(PWD)/vim/autoload $(HOME)/.vim/autoload
+ ln -s $(PWD)/vim/bundle $(HOME)/.vim/bundle
+ ln -s $(PWD)/vim/vimrc $(HOME)/.vimrc
+ ln -s $(PWD)/vim/gvimrc $(HOME)/.gvimrc
+
+install-wyrd :
+ rm -f $(HOME)/.wyrdrc
+ ln -s $(PWD)/wyrd/wyrdrc $(HOME)/.wyrdrc
+
+install-x : install-i3
+ rm -f $(HOME)/.Xmodmap $(HOME)/.Xresources \
+ $(HOME)/.xsession $(HOME)/.xsessionrc
+ ln -s $(PWD)/X/Xmodmap $(HOME)/.Xmodmap
+ ln -s $(PWD)/X/Xresources $(HOME)/.Xresources
+ ln -s $(PWD)/X/xsession $(HOME)/.xsession
+ ln -s $(PWD)/X/xsessionrc $(HOME)/.xsessionrc
+
diff --git a/README.markdown b/README.markdown
index b8801dab..7b219fc0 100644
--- a/README.markdown
+++ b/README.markdown
@@ -64,36 +64,31 @@ the defaults.
Installation
------------
-There’s an installation script, but it’s pretty bare-bones, so don’t run it
-without reading it first. You’ll need to have a recent enough version of Git to
-support [submodules](http://git-scm.com/book/en/Git-Tools-Submodules) for this
-to work.
+The installation `Makefile` will delete things standing in the way of its
+symbolic links, so read the output of `make -n` first to make sure you aren’t
+going to lose anything unexpected.
-To install the core terminal-only files (ack, Bash, cURL, Git, Vim), use the
-following:
+You’ll need to have a recent enough version of Git to support
+[submodules](http://git-scm.com/book/en/Git-Tools-Submodules) for the Vim
+installation to work; it’s required for the plugin setup.
+
+To install the core terminal-only files (ack, Bash, cURL, Git, GnuPG, Vim), use
+the following:
```bash
-$ ~/.dotfiles/install
+$ make install
```
-You can add any combination of the following options to add configuration for
-other tools:
-
-* `-d` — `mysql(1)` and `psql(1)`
-* `-g` — GnuPG
-* `-m` — Mutt
-* `-n` — Ncmpcpp
-* `-r` — Newsbeuter
-* `-t` — tmux
-* `-w` — Wyrd
-* `-x` — X11
-
-The script will prompt you about replacing old files. If you’re brave/insane,
-you can pipe `yes(1)` into it to accept all the replacements:
+The remaining dotfiles can be installed with the other targets:
-```bash
-$ yes | ~/.dotfiles/install -dgmnrtwx
-```
+* `install-mutt`
+* `install-ncmcpp`
+* `install-newsbeuter`
+* `install-mysql`
+* `install-psql`
+* `install-tmux`
+* `install-wyrd`
+* `install-x`
Shell
-----
diff --git a/install b/install
deleted file mode 100755
index 1798c834..00000000
--- a/install
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# Author: Tom Ryder (@tejr) <tom@sanctum.geek.nz>
-#
-# This script installs @tejr's dotfiles in $HOME with symlinks into the
-# expected $HOME/.dotfiles path.
-#
-# By default, it checks out all Git submodules, and links in configuration for
-# Bash, cURL, Git, Vim, and some terminfo(5) definitions. You can supply
-# additional flags to link in other configuration files:
-#
-# -d -- mysql(1), psql(1)
-# -g -- GnuPG
-# -m -- Mutt
-# -n -- Ncmpcpp
-# -r -- Newsbeuter
-# -t -- tmux
-# -w -- Wyrd
-# -x -- X11
-#
-# You should be prompted about replacing any file or directory that already
-# exists. I have tried to make the function that does this relatively safe, but
-# there are almost certainly edge cases where it might break things, especially
-# on systems other than GNU/Linux or BSD.
-#
-# Run this at your own risk!
-#
-self=install
-
-# Replace existing file with link if user confirms
-lns() {
- local file=$1 link=$2
- if [[ -e $link ]] ; then
- read -p "$link already exists; remove? [y/N] " confirm
- case $confirm in
- y*|Y*)
- rm -r -- "$link"
- ln -s -- "$file" "$link"
- return
- ;;
- *)
- return 1
- ;;
- esac
- else
- ln -s -- "$file" "$link"
- fi
- return
-}
-
-# Bail if we don't have git(1)
-if ! hash git ; then
- exit 1
-fi
-
-# Define dotfiles directory and check it exists
-dotfiles=$HOME/.dotfiles
-if ! [[ -d $dotfiles ]] ; then
- printf 'install: Could not find %s!\n' "$dotfiles" >&2
- exit 1
-fi
-
-# Check out submodules
-(cd -- "$dotfiles" && git submodule update --init)
-
-# Link in essential logical binaries
-mkdir -p -- "$HOME"/.local/bin
-lns "$dotfiles"/ack/ack "$HOME"/.local/bin/ack
-
-# Link in essential configuration files
-mkdir -p -- "$HOME"/.config
-lns "$dotfiles"/ack/ackrc "$HOME"/.ackrc
-lns "$dotfiles"/bash/bash_completion "$HOME"/.config/bash_completion
-lns "$dotfiles"/bash/bash_logout "$HOME"/.bash_logout
-lns "$dotfiles"/bash/bash_profile "$HOME"/.bash_profile
-lns "$dotfiles"/bash/bashrc "$HOME"/.bashrc
-lns "$dotfiles"/bash/bashrc.d "$HOME"/.bashrc.d
-lns "$dotfiles"/curl/curlrc "$HOME"/.curlrc
-lns "$dotfiles"/git/gitconfig "$HOME"/.gitconfig
-lns "$dotfiles"/readline/inputrc "$HOME"/.inputrc
-lns "$dotfiles"/sh/profile "$HOME"/.profile
-lns "$dotfiles"/sh/profile.d "$HOME"/.profile.d
-lns "$dotfiles"/vim/vimrc "$HOME"/.vimrc
-lns "$dotfiles"/vim "$HOME"/.vim
-
-# Link in shell stuff
-while getopts :dgmnrtwx opt ; do
- case $opt in
-
- # mysql(1), psql(1)
- d)
- lns "$dotfiles"/mysql/my.cnf "$HOME"/.my.cnf
- lns "$dotfiles"/psql/psqlrc "$HOME"/.psqlrc
- ;;
-
- # GnuPG
- g)
- mkdir -p -- "$HOME"/.gnupg
- lns "$dotfiles"/gnupg/gpg.conf "$HOME"/.gnupg/gpg.conf
- lns "$dotfiles"/gnupg/gpg-agent.conf "$HOME"/.gnupg/gpg-agent.conf
- ;;
-
- # Mutt
- m)
- # Warn about some non-obvious dependencies if necessary
- hash abook msmtp
-
- # Link in files
- lns "$dotfiles"/mutt/muttrc "$HOME"/.muttrc
- lns "$dotfiles"/mutt "$HOME"/.mutt
-
- # Create empty stubs if applicable
- touch "$dotfiles"/mutt/{muttrc.local,signature}
-
- # Create mailboxes and cache directories
- mkdir -p "$HOME"/Mail/{inbox,sent} \
- "$HOME"/.cache/mutt
- ;;
-
- # Ncmcpp
- n)
- lns "$dotfiles"/ncmpcpp "$HOME"/.ncmpcpp
- ;;
-
- # Newsbeuter
- r)
- mkdir -p -- "$HOME"/.config "$HOME"/.local/share/newsbeuter
- lns "$dotfiles"/newsbeuter "$HOME"/.config/newsbeuter
- ;;
-
- # Tmux
- t)
- lns "$dotfiles"/tmux/tmux.conf "$HOME"/.tmux.conf
- ;;
-
- # Wyrd
- w)
- lns "$dotfiles"/wyrd/wyrdrc "$HOME"/.wyrdrc
- ;;
-
- # X11
- x)
- lns "$dotfiles"/i3 "$HOME"/.i3
- lns "$dotfiles"/urxvt "$HOME"/.urxvt
- lns "$dotfiles"/X/Xmodmap "$HOME"/.Xmodmap
- lns "$dotfiles"/X/Xresources "$HOME"/.Xresources
- lns "$dotfiles"/X/xsession "$HOME"/.xsession
- lns "$dotfiles"/X/xsessionrc "$HOME"/.xsessionrc
- lns "$dotfiles"/vim/gvimrc "$HOME"/.gvimrc
- ;;
- esac
-done
-shift $((OPTIND-1))
-
-# Compile terminfo files
-if hash tic ; then
- for info in "$dotfiles"/terminfo/*.info ; do
- tic "$info"
- done
-fi
-