-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·154 lines (132 loc) · 3.62 KB
/
update.sh
File metadata and controls
executable file
·154 lines (132 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash -e
#
# Updates Vim plugins.
#
# Update everything (long):
#
# ./update.sh
#
# Update just the things from Git:
#
# ./update.sh repos
#
# Update just one plugin from the list of Git repos:
#
# ./update.sh repos powerline
#
vimdir=$HOME/.vim
bundledir=$vimdir/bundle
tmp=/tmp/$LOGNAME-vim-update
me=$vimdir/update.sh
# I have an old server with outdated CA certs.
if [ -n "$INSECURE" ]; then
curl='curl --insecure'
export GIT_SSL_NO_VERIFY=true
else
curl='curl'
fi
# URLS --------------------------------------------------------------------
# This is a list of all plugins which are available via Git repos. git:// URLs
# don't work.
repos=(
https://github.com/Lokaltog/vim-powerline.git
https://github.com/airblade/vim-gitgutter.git
https://github.com/altercation/vim-colors-solarized.git
https://github.com/docunext/closetag.vim.git
https://github.com/elzr/vim-json.git
https://github.com/ervandew/supertab
https://github.com/junegunn/goyo.vim.git
https://github.com/kien/ctrlp.vim.git
https://github.com/scrooloose/nerdcommenter.git
https://github.com/scrooloose/nerdtree.git
https://github.com/scrooloose/syntastic.git
https://github.com/tomasr/molokai.git
https://github.com/tpope/vim-fugitive.git
https://github.com/tpope/vim-liquid.git
https://github.com/tpope/vim-markdown.git
https://github.com/tpope/vim-pathogen.git
https://github.com/tpope/vim-sleuth.git
https://github.com/tpope/vim-surround.git
https://github.com/vim-scripts/bufkill.vim.git
https://github.com/vim-scripts/keepcase.vim.git
https://github.com/jnurmine/Zenburn.git
https://github.com/vim-scripts/taglist.vim
)
# Here's a list of everything else to download in the format
# <destination>;<url>[;<filename>]
other=(
)
case "$1" in
# GIT -----------------------------------------------------------------
repos|repo)
mkdir -p $bundledir
for url in ${repos[@]}; do
if [ -n "$2" ]; then
if ! (echo "$url" | grep "$2" &>/dev/null) ; then
continue
fi
fi
dest="$bundledir/$(basename $url | sed -e 's/\.git$//')"
rm -rf $dest
echo "Cloning $url into $dest"
git clone -q $url $dest
rm -rf $dest/.git
done
;;
# TARBALLS AND SINGLE FILES -------------------------------------------
other)
set -x
mkdir -p $bundledir
rm -rf $tmp
mkdir $tmp
pushd $tmp
for pair in ${other[@]}; do
parts=($(echo $pair | tr ';' '\n'))
name=${parts[0]}
url=${parts[1]}
filename=${parts[2]}
dest=$bundledir/$name
rm -rf $dest
if echo $url | egrep '.zip$'; then
# Zip archives from VCS tend to have an annoying outer wrapper
# directory, so unpacking them into their own directory first makes it
# easy to remove the wrapper.
f=download.zip
$curl -L $url >$f
unzip $f -d $name
mkdir -p $dest
mv $name/*/* $dest
rm -rf $name $f
else
# Assume single files. Create the destination directory and download
# the file there.
mkdir -p $dest
pushd $dest
if [ -n "$filename" ]; then
$curl -L $url >$filename
else
$curl -OL $url
fi
popd
fi
done
popd
rm -rf $tmp
;;
# HELP ----------------------------------------------------------------
all)
$me repos
$me other
echo
echo "Update OK"
;;
*)
set +x
echo
echo "Usage: $0 <section> [<filter>]"
echo "...where section is one of:"
grep -E '\w\)$' $me | sed -e 's/)//'
echo
echo "<filter> can be used with the 'repos' section."
exit 1
esac