Skip to content

Commit

Permalink
improve install script
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Sep 28, 2011
1 parent f48ab42 commit 54f571c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions install
@@ -1,24 +1,27 @@
#!/bin/bash

function relink() {
# relink target-file source-file
relink() {
if [[ -h "$1" ]]; then
echo "Relinking $1"
# Symbolic link? Then recreate.
rm "$1"
ln -sn "$2" "$1"
elif [[ ! -e "$1" ]]; then
echo "Linking $1"
echo "Linking $1 to $2"
ln -sn "$2" "$1"
else
echo "$1 exists as a real file, skipping."
fi
}

cd ~
relink .bash_profile ~/.dotfiles/bash_profile
relink .bashrc ~/.dotfiles/bashrc
relink .gitconfig ~/.dotfiles/git-config
relink .gitignore ~/.dotfiles/git-ignore-global
relink .hgrc ~/.dotfiles/hgrc
relink .inputrc ~/.dotfiles/inputrc
relink bin ~/.dotfiles/bin
DIR=$( cd "$( dirname "$0" )" && pwd )

relink ~/.bash_profile $DIR/bash_profile
relink ~/.bashrc $DIR/bashrc
relink ~/.gitconfig $DIR/git-config
relink ~/.gitignore $DIR/git-ignore-global
relink ~/.hgrc $DIR/hgrc
relink ~/.inputrc $DIR/inputrc

relink ~/bin $DIR/bin

0 comments on commit 54f571c

Please sign in to comment.