2 # Mirror some Git repos
5 echo 'Usage: git-mirror [command] [arguments]
6 git-mirror run [path to repos] [path to log file] [html directory]
7 optional: [sleep duration]
8 git-mirror gen-url [path to repo] -- generate url file in repo
9 git-mirror help -- show this message
11 relative paths are not supported, but globs are.
12 To use, first clone the wanted somewhere repos with the --mirror flag.'
16 [ -z ${3} ] && echo "not enough arguments" && exit 1
17 [ -z $(which stagit) ] && echo "please install stagit" && exit 1
18 [ -z $(which minify) ] && echo "please install minify" && exit 1
22 [ -d ${3} ] || mkdir ${3}
27 find "$1" -name '*.git' -type d | \
29 newdir=${3}/$(basename ${dir} .git)
30 [ -d ${newdir} ] || mkdir ${newdir}
34 ln -s logo.png favicon.png
35 find . -type f \( -name '*.html' -or -name '*.xml' \) | \
37 minify ${i} > ${i}.tmp
40 git -C ${dir} fetch --tags
41 echo $(date -Iseconds) ' | ' ${dir} | tee -a ${2}
42 echo $(tail -n 1500 ${2}) > ${2}
49 find ${1} -maxdepth 2 -name '*.git' | \
51 $(git -C $dir remote get-url origin) > $dir/url