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 git-mirror gen-url [path to repo] -- generate url file in repo
8 git-mirror help -- show this message
10 relative paths are not supported, but globs are.
11 To use, first clone the wanted somewhere repos with the --mirror flag.'
15 [ -z ${3} ] && echo "not enough arguments" && exit 1
16 [ -z $(which stagit) ] && echo "please install stagit" && exit 1
17 [ -z $(which minify) ] && echo "please install minify" && exit 1
21 [ -d ${3} ] || mkdir ${3}
22 cd ${3} && stagit-index ${1}/*
25 find "$1" -name '*.git' -type d | \
27 newdir=${3}/$(basename ${dir} .git)
28 [ -d ${newdir} ] || mkdir ${newdir}
32 ln -s logo.png favicon.png
33 find . -type f \( -name '*.html' -or -name '*.xml' \) | \
35 minify ${i} > ${i}.tmp
38 git -C ${dir} fetch --tags
39 echo $(date -Iseconds) ' | ' ${dir} | tee -a ${2}
40 echo $(tail -n 1500 ${2}) > ${2}
47 find ${1} -maxdepth 2 -name '*.git' | \
49 $(git -C $dir remote get-url origin) > $dir/url