Initial commit.

This commit is contained in:
Ian Adam Naval 2014-03-26 21:18:58 -04:00
commit 8705a75fba
3 changed files with 95 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (c) Ian Adam Naval, https://ianonavy.com/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Ian's Dotfiles
Nothing to see here; just my dotfiles.

71
install-dotfiles.sh Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# Symlinks ALL the things! (really just all the .dotfile files)
set -e
cd "$(dirname $0)"
export DOTFILES_ROOT="`pwd`"
create_link () {
ln -s $1 $2
echo "linked $1 to $2"
}
overwrite_all=false
backup_all=false
skip_all=false
for src in `find $DOTFILES_ROOT -name \*.dotfile`
do
dest="$HOME/.`basename \"${src%.*}\"`"
if [ -f $dest ] || [ -d $dest ]
then
overwrite=false
backup=false
skip=false
if [ "$overwrite_all" == "false" ] && [ "$backup_all" == "false" ] && [ "$skip_all" == "false" ]
then
echo "conflict adding $dest"
echo "[s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all: "
echo -n "> "
read -n 1 cmd
echo ""
case "$cmd" in
o ) overwrite=true;;
O ) overwrite_all=true;;
b ) backup=true;;
B ) backup_all=true;;
s ) skip=true;;
S ) skip_all=true;;
* ) ;;
esac
fi
if [ "$overwrite" == "true" ] || [ "$overwrite_all" == "true" ]
then
rm -rf $dest
echo "removed $dest"
fi
if [ "$backup" == "true" ] || [ "$backup_all" == "true" ]
then
mv $dest $dest\.bak
echo "moved $dest to $dest.bak"
fi
if [ "$skip" == "true" ] || [ "$skip_all" == "true" ]
then
echo "skipped $src"
else
create_link $src $dest
fi
else
create_link $src $dest
fi
done
find . -name setup.sh | while read setup; do sh -c "${setup}"; done