Created
June 19, 2012 20:42
-
-
Save dentarg/2956427 to your computer and use it in GitHub Desktop.
Symlink stuff from home.git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| add_dir_link() { | |
| DIR=$1 | |
| cd $HOME | |
| if [ -L $DIR ]; then | |
| echo "Link exists: $DIR" | |
| elif [ -d $DIR ]; then | |
| echo "Dir exists: $DIR" | |
| else | |
| ln -s home.git/$DIR | |
| echo "Added symlink: $DIR" | |
| fi | |
| } | |
| add_file_link() { | |
| FILE=$1 | |
| cd $HOME | |
| if [ -L $FILE ]; then | |
| echo "Link exists: $FILE" | |
| elif [ -f $FILE ]; then | |
| echo "File exists: $FILE" | |
| else | |
| ln -s home.git/$FILE | |
| echo "Added symlink: $FILE" | |
| fi | |
| } | |
| add_dir() { | |
| DIR=$1 | |
| cd $HOME | |
| if [ -d $DIR ]; then | |
| echo "Dir exists: $DIR" | |
| else | |
| mkdir $DIR | |
| echo "Added dir: $DIR" | |
| fi | |
| } | |
| add_deep_link() { | |
| DIR=$1 | |
| FILENAME=$2 | |
| FILE=$DIR/$FILENAME | |
| cd $HOME | |
| if [ -L $FILE ]; then | |
| echo "Link exists: $FILE" | |
| elif [ -f $FILE ]; then | |
| echo "File exists: $FILE" | |
| elif [ -d $DIR ]; then | |
| ln -s ../home.git/$FILE $FILE | |
| echo "Added symlink: $FILE" | |
| else | |
| mkdir $DIR | |
| ln -s ../home.git/$FILE $FILE | |
| echo "Added symlink: $FILE" | |
| fi | |
| } | |
| add_dir .vim_backups | |
| add_dir_link .vim | |
| add_dir_link bin | |
| add_deep_link .ssh config | |
| add_deep_link .ssh authorized_keys | |
| add_deep_link .lftp rc | |
| # machine specific .zshrc | |
| HOSTNAME=`hostname | cut -f 1 -d .` | |
| add_file_link .zshrc_$HOSTNAME | |
| add_file_link .zshrc | |
| add_file_link .vimrc | |
| add_file_link .hgrc | |
| add_file_link .gemrc | |
| add_file_link .gitconfig | |
| add_file_link .rtorrent.rc | |
| add_file_link .Xdefaults | |
| add_file_link .dir_colors | |
| add_file_link .tmux.conf | |
| add_file_link .rspec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| add_dir_link() { | |
| DIR=$1 | |
| cd $HOME | |
| if [ -L $DIR ]; then | |
| echo "Link exists: $DIR" | |
| elif [ -d $DIR ]; then | |
| echo "Dir exists: $DIR" | |
| else | |
| ln -s home.git/$DIR | |
| echo "Added symlink: $DIR" | |
| fi | |
| } | |
| add_file_link() { | |
| FILE=$1 | |
| cd $HOME | |
| if [ -L $FILE ]; then | |
| echo "Link exists: $FILE" | |
| elif [ -f $FILE ]; then | |
| echo "File exists: $FILE" | |
| else | |
| ln -s home.git/$FILE | |
| echo "Added symlink: $FILE" | |
| fi | |
| } | |
| add_dir() { | |
| DIR=$1 | |
| cd $HOME | |
| if [ -d $DIR ]; then | |
| echo "Dir exists: $DIR" | |
| else | |
| mkdir $DIR | |
| echo "Added dir: $DIR" | |
| fi | |
| } | |
| add_deep_link() { | |
| DIR=$1 | |
| FILENAME=$2 | |
| FILE=$DIR/$FILENAME | |
| cd $HOME | |
| if [ -L $FILE ]; then | |
| echo "Link exists: $FILE" | |
| elif [ -f $FILE ]; then | |
| echo "File exists: $FILE" | |
| elif [ -d $DIR ]; then | |
| ln -s ../home.git/$FILE $FILE | |
| echo "Added symlink: $FILE" | |
| else | |
| mkdir $DIR | |
| ln -s ../home.git/$FILE $FILE | |
| echo "Added symlink: $FILE" | |
| fi | |
| } | |
| add_dir .vim_backups | |
| add_dir_link .vim | |
| add_dir_link bin | |
| add_deep_link .ssh config | |
| add_deep_link .ssh authorized_keys | |
| add_deep_link .lftp rc | |
| # machine specific .zshrc | |
| HOSTNAME=`hostname | cut -f 1 -d .` | |
| add_file_link .zshrc_$HOSTNAME | |
| add_file_link .zshrc | |
| add_file_link .vimrc | |
| add_file_link .hgrc | |
| add_file_link .gemrc | |
| add_file_link .gitconfig | |
| add_file_link .rtorrent.rc | |
| add_file_link .Xdefaults | |
| add_file_link .dir_colors | |
| add_file_link .tmux.conf | |
| add_file_link .rspec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment