Commit edce9781e6125a3961a5ca456e5a32a9b2fdc509

Authored by Ian Foster
1 parent b204d4da0e
Exists in master

ssh config

Showing 2 changed files with 18 additions and 3 deletions Inline Diff

#!/usr/bin/env bash 1 1 #!/usr/bin/env bash
2 2
# the dir this script is in 3 3 # the dir this script is in
cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 4 cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5 5
#helper functions 6 6 #helper functions
function link { 7 7 function link {
target=$1 8 8 target=$1
src=$2 9 9 src=$2
if [ -L $src ]; 10 10 if [ -L $src ];
then 11 11 then
rm $src 12 12 rm $src
fi 13 13 fi
mkdir -p `dirname $src` 14 14 mkdir -p `dirname $src`
echo "Creating symlink for $src" 15 15 echo "Creating symlink for $src"
ln -sf $target $src 16 16 ln -sf $target $src
} 17 17 }
18 18
function downloadSubmodules { 19 19 function downloadSubmodules {
dir=$1 20 20 dir=$1
if [ -e $dir/submodules ]; 21 21 if [ -e $dir/submodules ];
then 22 22 then
while read l; 23 23 while read l;
do 24 24 do
if [ -n "$l" ]; 25 25 if [ -n "$l" ];
then 26 26 then
read -a array <<< $l 27 27 read -a array <<< $l
if [ ! -e $dir/${array[1]} ]; 28 28 if [ ! -e $dir/${array[1]} ];
then 29 29 then
git clone ${array[0]} $dir/${array[1]} 30 30 git clone ${array[0]} $dir/${array[1]}
else 31 31 else
echo "Updating git repo ${array[1]}" 32 32 echo "Updating git repo ${array[1]}"
git --git-dir=$dir/${array[1]}/.git pull 33 33 git --git-dir=$dir/${array[1]}/.git pull
fi 34 34 fi
fi 35 35 fi
done < $dir/submodules 36 36 done < $dir/submodules
fi 37 37 fi
} 38 38 }
39 39
40 40
#config functions 41 41 #config functions
function vim { 42 42 function vim {
echo "Linking vim" 43 43 echo "Linking vim"
downloadSubmodules $cwd/vim 44 44 downloadSubmodules $cwd/vim
link $cwd/vim/vimrc ~/.vimrc 45 45 link $cwd/vim/vimrc ~/.vimrc
link $cwd/vim/vim ~/.vim 46 46 link $cwd/vim/vim ~/.vim
} 47 47 }
48 48
function conky { 49 49 function conky {
echo "Linking conky" 50 50 echo "Linking conky"
link $cwd/conky/conkyrc ~/.conkyrc 51 51 link $cwd/conky/conkyrc ~/.conkyrc
} 52 52 }
53 53
#can not be called git, conflicts with download submodules 54 54 #can not be called git, conflicts with download submodules
function git_config { 55 55 function git_config {
echo "Linking git" 56 56 echo "Linking git"
for file in $(ls $cwd/git); 57 57 for file in $(ls $cwd/git);
do 58 58 do
link $cwd/git/$file ~/.$file 59 59 link $cwd/git/$file ~/.$file
done 60 60 done
} 61 61 }
62 62
function shell { 63 63 function shell {
echo "Linking shell" 64 64 echo "Linking shell"
for file in $(ls $cwd/shell); 65 65 for file in $(ls $cwd/shell);
do 66 66 do
link $cwd/shell/$file ~/.$file 67 67 link $cwd/shell/$file ~/.$file
done 68 68 done
} 69 69 }
70 70
function tmux { 71 71 function tmux {
echo "Linking tmux" 72 72 echo "Linking tmux"
link $cwd/tmux/tmux.conf ~/.tmux.conf 73 73 link $cwd/tmux/tmux.conf ~/.tmux.conf
} 74 74 }
75 75
function xscreensaver { 76 76 function xscreensaver {
echo "Linking xscreensaver" 77 77 echo "Linking xscreensaver"
link $cwd/xscreensaver/xscreensaver ~/.xscreensaver 78 78 link $cwd/xscreensaver/xscreensaver ~/.xscreensaver
} 79 79 }
80 80
function awesome { 81 81 function awesome {
echo "Linking awesome" 82 82 echo "Linking awesome"
downloadSubmodules $cwd/awesome 83 83 downloadSubmodules $cwd/awesome
link $cwd/awesome/awesome ~/.config/awesome 84 84 link $cwd/awesome/awesome ~/.config/awesome
} 85 85 }
86 86
function openbox { 87 87 function openbox {
echo "Linking openbox" 88 88 echo "Linking openbox"
link $cwd/openbox/openbox ~/.config/openbox 89 89 link $cwd/openbox/openbox ~/.config/openbox
} 90 90 }
91 91
function terminator { 92 92 function terminator {
echo "Linking terminator" 93 93 echo "Linking terminator"
link $cwd/terminator/terminator ~/.config/terminator 94 94 link $cwd/terminator/terminator ~/.config/terminator
} 95 95 }
96 96
function tint2 { 97 97 function tint2 {
echo "Linking tint2" 98 98 echo "Linking tint2"
link $cwd/tint2/tint2 ~/.config/tint2 99 99 link $cwd/tint2/tint2 ~/.config/tint2
} 100 100 }
101 101
function sublime { 102 102 function sublime {
echo "Linking Sublime Text" 103 103 echo "Linking Sublime Text"
link $cwd/sublime-text-3/User ~/.config/sublime-text-3/Packages/User 104 104 link $cwd/sublime-text-3/User ~/.config/sublime-text-3/Packages/User
echo "Downloading Package Manager PLugin" 105 105 echo "Downloading Package Manager PLugin"
wget -P ~/.config/sublime-text-3/Installed\ Packages/ https://sublime.wbond.net/Package%20Control.sublime-package 106 106 wget -P ~/.config/sublime-text-3/Installed\ Packages/ https://sublime.wbond.net/Package%20Control.sublime-package
} 107 107 }
108 108
function scripts { 109 109 function scripts {
echo "Linking scripts" 110 110 echo "Linking scripts"
for script in $cwd/scripts/* 111 111 for script in $cwd/scripts/*
do 112 112 do
link $script ~/bin/$(basename $script) 113 113 link $script ~/bin/$(basename $script)
done 114 114 done
} 115 115 }
116 116
117 function ssh {
118 echo "Linking ssh"
119 SSH_CONFIG=~/Dropbox/config/ssh
120 if [ -e "$SSH_CONFIG" ];
121 then
122 link $SSH_CONFIG ~/.ssh/config
123 else
124 echo "$SSH_CONFIG does not exist!"
125 fi
126 }
127
128
function run { 117 129 function run {
if [ $1 == "git" ]; 118 130 p="${1%/}"
131 if [ $p == "git" ];
then 119 132 then
c="git_config" 120 133 c="git_config"
elif [ $1 == "sublime-text-3" ]; 121 134 elif [ $p == "sublime-text-3" ];
then 122 135 then
c="sublime" 123 136 c="sublime"
else 124 137 else
c=$1 125 138 c=$p
fi 126 139 fi
eval ${c} 127 140 eval ${c}
} 128 141 }
129 142
function all { 130 143 function all {
echo "Linking all configs" 131 144 echo "Linking all configs"
for dir in $cwd/*/ 132 145 for dir in $cwd/*/
ssh/.gitignore View file @ edce978
File was created 1 *
2 !.gitignore