diff --git a/README.md b/README.md new file mode 100644 index 0000000..6deff90 --- /dev/null +++ b/README.md @@ -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 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..b2b6e57 --- /dev/null +++ b/install.sh @@ -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}"