-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathupdate.sh
executable file
·37 lines (31 loc) · 900 Bytes
/
update.sh
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
#!/usr/bin/env bash
echo "Updating environment...."
git fetch && git pull origin master && echo ""
# Make sure src directory exists.
mkdir -p src
# Edit this value to your VIP Go repo.
wp_repo="Automattic/vip-go-skeleton"
# Clone git repos.
for repo in \
$wp_repo \
Automattic/vip-go-mu-plugins \
tollmanz/wordpress-pecl-memcached-object-cache
do
dir_name="${repo##*/}"
if [ "$repo" == "$wp_repo" ]; then
dir_name="wp"
fi
# Clone repo if it is not in the "src" subfolder.
if [ ! -d "src/$dir_name/.git" ]; then
echo "Cloning $repo in the \"src\" subfolder...."
rm -rf src/$dir_name
git clone --recursive [email protected]:$repo "src/$dir_name"
fi
# Make sure repos are up-to-date.
echo "Updating $repo...."
pushd src/$dir_name >/dev/null && \
git pull origin master --ff-only && \
git submodule update && \
popd >/dev/null && \
echo ""
done