Add install script and README

This commit is contained in:
Adam Gausmann 2018-12-17 00:16:37 -06:00
parent a70063ca5b
commit 9e3468fa45
2 changed files with 35 additions and 0 deletions

22
README.md Normal file
View file

@ -0,0 +1,22 @@
# dotfiles
My personal dotfiles and configurations.
## The Contents
- `common` - A set of configuration files common to every system.
- `$hostname` - Configuration files specific to the system with the given hostname.
- `$x` - Additional (optional) configurations that can also be added.
## The System
Each subdirectory of this repository is a collection of files to install
relative to the current user's home directory (assumed to be `$HOME`)
which are merged into the home directory by the `install.sh` script.
The script chooses specific subdirectories and merges them in the following
order, with precedence given to the more recently-listed subdirectory if two or
more contain a file at the same path:
- Command-line arguments (precedence given first-to-last)
- System hostname
- The `common` directory

13
install.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
dotfiles_dir="${DOTFILES:-$(dirname "$(realpath "$0")")}"
hostname="${HOSTNAME:-$(hostname)}"
customs=$(
for i in $@
do
echo "${dotfiles_dir}/${i}/"
done
)
rsync -lr ${customs} "${dotfiles_dir}/${hostname}/" "${dotfiles_dir}/common/" "${HOME}"