From 392c34038f6be38223391ea4586ead61bac3f33d Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 24 May 2015 04:01:23 -0400 Subject: Replace effuse with simple shell scripts --- .gitmodules | 0 README.md | 12 ++++++++++++ effuse.yml | 4 ---- import.sh | 21 +++++++++++++++++++++ install.sh | 24 ++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 4 deletions(-) delete mode 100644 .gitmodules delete mode 100644 effuse.yml create mode 100755 import.sh create mode 100755 install.sh diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29b..00000000 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 -- cgit 1.4.1