Commit af6d2e8486a8e1ddb97c446a06fd7a037abf306d
1 parent
e035d8ef3f
Exists in
master
ignore blank lines on submodule files
Showing 2 changed files with 10 additions and 8 deletions Inline Diff
awesome/submodules
View file @
af6d2e8
https://github.com/bioe007/awesome-revelation.git awesome/revelation | 1 | 1 | https://github.com/bioe007/awesome-revelation.git awesome/revelation | |
https://github.com/terceiro/awesome-freedesktop.git awesome/awesome-freedesktop | 2 | 2 | https://github.com/terceiro/awesome-freedesktop.git awesome/awesome-freedesktop | |
https://github.com/cedlemo/blingbling.git awesome/blingbling | 3 | 3 | https://github.com/cedlemo/blingbling.git awesome/blingblin | |
4 | 4 |
link.sh
View file @
af6d2e8
#!/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 | |
read -a array <<< $l | 25 | 25 | if [ -n "$l" ]; | |
if [ ! -e $dir/${array[1]} ]; | 26 | |||
then | 27 | 26 | then | |
git clone ${array[0]} $dir/${array[1]} | 28 | 27 | read -a array <<< $l | |
else | 29 | 28 | if [ ! -e $dir/${array[1]} ]; | |
echo "Updating git repo ${array[1]}" | 30 | 29 | then | |
git --git-dir=$dir/${array[1]}/.git pull | 31 | 30 | git clone ${array[0]} $dir/${array[1]} | |
31 | else | |||
32 | echo "Updating git repo ${array[1]}" | |||
33 | git --git-dir=$dir/${array[1]}/.git pull | |||
34 | fi | |||
fi | 32 | 35 | fi | |
done < $dir/submodules | 33 | 36 | done < $dir/submodules | |
fi | 34 | 37 | fi | |
} | 35 | 38 | } | |
36 | 39 | |||
37 | 40 | |||
#config functions | 38 | 41 | #config functions | |
function vim { | 39 | 42 | function vim { | |
echo "Linking vim" | 40 | 43 | echo "Linking vim" | |
downloadSubmodules $cwd/vim | 41 | 44 | downloadSubmodules $cwd/vim | |
link $cwd/vim/vimrc ~/.vimrc | 42 | 45 | link $cwd/vim/vimrc ~/.vimrc | |
link $cwd/vim/vim ~/.vim | 43 | 46 | link $cwd/vim/vim ~/.vim | |
} | 44 | 47 | } | |
45 | 48 | |||
function conky { | 46 | 49 | function conky { | |
echo "Linking conky" | 47 | 50 | echo "Linking conky" | |
link $cwd/conky/conkyrc ~/.conkyrc | 48 | 51 | link $cwd/conky/conkyrc ~/.conkyrc | |
} | 49 | 52 | } | |
50 | 53 | |||
#can not be called git, conflicts with download submodules | 51 | 54 | #can not be called git, conflicts with download submodules | |
function git_config { | 52 | 55 | function git_config { | |
echo "Linking git" | 53 | 56 | echo "Linking git" | |
for file in $(ls $cwd/git); | 54 | 57 | for file in $(ls $cwd/git); | |
do | 55 | 58 | do | |
link $cwd/git/$file ~/.$file | 56 | 59 | link $cwd/git/$file ~/.$file | |
done | 57 | 60 | done | |
} | 58 | 61 | } | |
59 | 62 | |||
function shell { | 60 | 63 | function shell { | |
echo "Linking shell" | 61 | 64 | echo "Linking shell" | |
for file in $(ls $cwd/shell); | 62 | 65 | for file in $(ls $cwd/shell); | |
do | 63 | 66 | do | |
link $cwd/shell/$file ~/.$file | 64 | 67 | link $cwd/shell/$file ~/.$file | |
done | 65 | 68 | done | |
} | 66 | 69 | } | |
67 | 70 | |||
function tmux { | 68 | 71 | function tmux { | |
echo "Linking tmux" | 69 | 72 | echo "Linking tmux" | |
link $cwd/tmux/tmux.conf ~/.tmux.conf | 70 | 73 | link $cwd/tmux/tmux.conf ~/.tmux.conf | |
} | 71 | 74 | } | |
72 | 75 | |||
function xscreensaver { | 73 | 76 | function xscreensaver { | |
echo "Linking xscreensaver" | 74 | 77 | echo "Linking xscreensaver" | |
link $cwd/xscreensaver/xscreensaver ~/.xscreensaver | 75 | 78 | link $cwd/xscreensaver/xscreensaver ~/.xscreensaver | |
} | 76 | 79 | } | |
77 | 80 | |||
function awesome { | 78 | 81 | function awesome { | |
echo "Linking awesome" | 79 | 82 | echo "Linking awesome" | |
downloadSubmodules $cwd/awesome | 80 | 83 | downloadSubmodules $cwd/awesome | |
link $cwd/awesome/awesome ~/.config/awesome | 81 | 84 | link $cwd/awesome/awesome ~/.config/awesome | |
} | 82 | 85 | } | |
83 | 86 | |||
function openbox { | 84 | 87 | function openbox { | |
echo "Linking openbox" | 85 | 88 | echo "Linking openbox" | |
link $cwd/openbox/openbox ~/.config/openbox | 86 | 89 | link $cwd/openbox/openbox ~/.config/openbox | |
} | 87 | 90 | } | |
88 | 91 | |||
function terminator { | 89 | 92 | function terminator { | |
echo "Linking terminator" | 90 | 93 | echo "Linking terminator" | |
link $cwd/terminator/terminator ~/.config/terminator | 91 | 94 | link $cwd/terminator/terminator ~/.config/terminator | |
} | 92 | 95 | } | |
93 | 96 | |||
function tint2 { | 94 | 97 | function tint2 { | |
echo "Linking tint2" | 95 | 98 | echo "Linking tint2" | |
link $cwd/tint2/tint2 ~/.config/tint2 | 96 | 99 | link $cwd/tint2/tint2 ~/.config/tint2 | |
} | 97 | 100 | } | |
98 | 101 | |||
function scripts { | 99 | 102 | function scripts { | |
#DO NOTHING | 100 | 103 | #DO NOTHING | |
echo "Skipping scripts" | 101 | 104 | echo "Skipping scripts" | |
} | 102 | 105 | } | |
103 | 106 | |||
function run { | 104 | 107 | function run { | |
if [ $1 == "git" ]; | 105 | 108 | if [ $1 == "git" ]; | |
then | 106 | 109 | then | |
c="git_config" | 107 | 110 | c="git_config" | |
else | 108 | 111 | else | |
c=$1 | 109 | 112 | c=$1 | |
fi | 110 | 113 | fi | |
eval ${c} | 111 | 114 | eval ${c} | |
} | 112 | 115 | } | |
113 | 116 | |||
function all { | 114 | 117 | function all { | |
echo "Linking all configs" | 115 | 118 | echo "Linking all configs" | |
for dir in $cwd/*/ | 116 | 119 | for dir in $cwd/*/ | |
do | 117 | 120 | do | |
dir=${dir%*/} | 118 | 121 | dir=${dir%*/} | |
dir=${dir##*/} | 119 | 122 | dir=${dir##*/} |