#!/bin/sh
GITHUB="https://github.com"
DSTDIR="/home/ghw/wwwroot"
REPOS="gehaowu/gehaowu.github.io master www.gehaowu.com
gehaowu/zh-Hans gh-pages www.gehaowu.com/zh-Hans
gehaowu/notes gh-pages www.gehaowu.com/notes
gehaowu/albums gh-pages www.gehaowu.com/albums
gehaowu/resume gh-pages www.gehaowu.com/resume
gehaowu/data gh-pages www.gehaowu.com/data
gehaowu/Resources gh-pages www.gehaowu.com/Resources"
while read repo branch dir
do
(cd "${DSTDIR}/${dir}" && git pull)
if [ "$?" -ne 0 ]; then
rm -fr "${DSTDIR}/${dir}"
git clone --depth 1 -b "${branch}" "${GITHUB}/${repo}" "${DSTDIR}/${dir}"
fi
done <<-EOF
${REPOS}
EOF