-#!/usr/bin/sh
+#!/usr/bin/env sh
# Mirror some Git repos
usage() {
cd ${1}
[ -d ${3} ] || mkdir ${3}
- cd ${3} && stagit-index
+ cd ${3} && stagit-index ${1}/*
cp /usr/share/doc/stagit/style.css ${3}
while :; do
- for dir in "${1}/*.git"; do
+ find "$1" -name '*.git' -type d | \
+ while read dir; do
newdir=${3}/$(basename ${dir} .git)
[ -d ${newdir} ] || mkdir ${newdir}
cd ${newdir}
minify ${i} > ${i}.tmp
mv ${i}.tmp ${i}
done
- cp /usr/share/doc/stagit/style.css .
- git -C ${dir} fetch --tags
- echo $(date -Iseconds) ' | ' ${dir} | tee -a ${2}
- echo $(tail -n 1500 ${2}) > ${2}
+ cp /usr/share/doc/stagit/style.css .
+ git -C ${dir} fetch --tags
+ echo $(date -Iseconds) ' | ' ${dir} | tee -a ${2}
+ echo $(tail -n 1500 ${2}) > ${2}
+ done
+ sleep 600
done
- sleep 600
- done
-}
+ }
-gen_url() {
- find ${1} -maxdepth 2 -name '*.git' | \
- while read dir; do
- $(git -C $dir remote get-url origin) > $dir/url
- done
-}
+ gen_url() {
+ find ${1} -maxdepth 2 -name '*.git' | \
+ while read dir; do
+ $(git -C $dir remote get-url origin) > $dir/url
+ done
+ }
-case ${1} in
- -h | --help | help)
- usage
- ;;
- run)
- shift 1
- run $@
- ;;
- gen-url)
- shift 1
- gen_url $@
- ;;
- *)
- usage
- exit 1
- ;;
-esac
+ case ${1} in
+ -h | --help | help)
+ usage
+ ;;
+ run)
+ shift 1
+ run $@
+ ;;
+ gen-url)
+ shift 1
+ gen_url $@
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac