summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitmodules0
-rw-r--r--README.md12
-rw-r--r--effuse.yml4
-rwxr-xr-ximport.sh21
-rwxr-xr-xinstall.sh24
5 files changed, 57 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index e69de29b..00000000
--- a/.gitmodules
+++ /dev/null
diff --git a/README.md b/README.md
index f08715f0..893c9347 100644
--- a/README.md
+++ b/README.md
@@ -10,3 +10,15 @@ My configuration files.
 - psql
 - iTerm 2
 - Karabiner
+
+## Install
+
+```
+./install.sh
+```
+
+## Import
+
+```
+./import .config
+```
diff --git a/effuse.yml b/effuse.yml
deleted file mode 100644
index e2ed404f..00000000
--- a/effuse.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-exclude:
-  - .DS_Store
-  - README.md
-  - com.googlecode.iterm2.plist
diff --git a/import.sh b/import.sh
new file mode 100755
index 00000000..f9233ba8
--- /dev/null
+++ b/import.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/bash
+
+# Import a file from ~ and replace it with a symlink.
+
+set -e
+
+error() {
+  echo "$1"
+  exit 1
+}
+
+[ -z "$1" ] && error "no path"
+
+source_path="$HOME/$1"
+dest_path="$PWD/$1"
+
+[ -f "$dest_path" ] && error "$dest_path already exists"
+[ -f "$source_path" ] || error "$source_path does not exist"
+
+mv "$source_path" "$dest_path"
+ln -s "$dest_path" "$source_path"
diff --git a/install.sh b/install.sh
new file mode 100755
index 00000000..e0ed0c5f
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/bash
+
+# Create symlinks in ~ for files in the current directory.
+
+set -e
+
+error() {
+  echo "$1"
+  exit 1
+}
+
+paths=$(find $PWD -type f -not \( -path '*/.git/*' -o -path '*/Library/*' -o -name '.*.sw?' -o -name '.gitignore' -o -name 'README.md' -o -name '*.sh' -o -name '*.plist' \))
+
+for source_path in $paths; do
+  rel_path="${source_path#$PWD/}"
+  dest_path="$HOME/$rel_path"
+
+  [ -h "$dest_path" ] && continue
+  [ -e "$dest_path" ] && error "$dest_path exists"
+
+  mkdir -p "$(dirname $dest_path)"
+  ln -s "$source_path" "$dest_path"
+  echo "$rel_path"
+done