Beginning to support Git
This commit is contained in:
parent
c504f8d601
commit
7ccaac1249
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2012 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org>
|
||||||
#This file is part of DeforaOS Devel scripts
|
#This file is part of DeforaOS Devel scripts
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#This program is free software: you can redistribute it and/or modify
|
||||||
#it under the terms of the GNU General Public License as published by
|
#it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,18 +19,25 @@
|
||||||
#environment
|
#environment
|
||||||
umask 022
|
umask 022
|
||||||
#variables
|
#variables
|
||||||
[ -z "$CVSROOT" ] && CVSROOT=":pserver:anonymous@anoncvs.defora.org:/home/cvs"
|
|
||||||
DATE=`date '+%Y%m%d'`
|
DATE=`date '+%Y%m%d'`
|
||||||
DESTDIR="/var/www"
|
DESTDIR="/var/www"
|
||||||
DEVNULL="/dev/null"
|
DEVNULL="/dev/null"
|
||||||
EMAIL="webmaster@defora.org"
|
EMAIL="webmaster@defora.org"
|
||||||
ROOT=
|
ROOT=
|
||||||
MODULE="DeforaOS"
|
|
||||||
SRC=
|
SRC=
|
||||||
|
|
||||||
|
#CVS
|
||||||
|
CVSMODULE="DeforaOS"
|
||||||
|
[ -z "$CVSROOT" ] && CVSROOT=":pserver:anonymous@anoncvs.defora.org:/home/cvs"
|
||||||
|
|
||||||
|
#Git
|
||||||
|
[ -z "$GITROOT" ] && GITROOT="git://github.com/DeforaOS/DeforaOS.git"
|
||||||
|
|
||||||
#executables
|
#executables
|
||||||
|
CONFIGURE="configure"
|
||||||
CVS="cvs -q"
|
CVS="cvs -q"
|
||||||
FIND="find"
|
FIND="find"
|
||||||
|
GIT="git"
|
||||||
INSTALL="install -m 0644"
|
INSTALL="install -m 0644"
|
||||||
LN="ln -f"
|
LN="ln -f"
|
||||||
MAIL="mail"
|
MAIL="mail"
|
||||||
|
@ -42,9 +49,11 @@ TOUCH="touch"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
#deforaos_document
|
#deforaos_document_cvs
|
||||||
_deforaos_document()
|
_deforaos_document_cvs()
|
||||||
{
|
{
|
||||||
|
[ -n "$SRC" ] || SRC="$ROOT/$CVSMODULE"
|
||||||
|
|
||||||
#configure cvs if necessary
|
#configure cvs if necessary
|
||||||
$MKDIR -- "$HOME" || exit 2
|
$MKDIR -- "$HOME" || exit 2
|
||||||
if [ ! -f "$HOME/.cvspass" ]; then
|
if [ ! -f "$HOME/.cvspass" ]; then
|
||||||
|
@ -54,14 +63,14 @@ _deforaos_document()
|
||||||
#checkout tree if necessary
|
#checkout tree if necessary
|
||||||
if [ ! -d "$SRC" ]; then
|
if [ ! -d "$SRC" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "Checking out CVS module $MODULE:"
|
echo "Checking out CVS module $CVSMODULE:"
|
||||||
(cd "$ROOT" && $CVS "-d$CVSROOT" co "$MODULE") > "$DEVNULL" \
|
(cd "$ROOT" && $CVS "-d$CVSROOT" co "$CVSMODULE") > "$DEVNULL" \
|
||||||
|| exit 2
|
|| exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#document tree
|
#document tree
|
||||||
echo ""
|
echo ""
|
||||||
echo "Documenting CVS module $MODULE:"
|
echo "Documenting CVS module $CVSMODULE:"
|
||||||
|
|
||||||
#manual pages
|
#manual pages
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -86,18 +95,56 @@ _deforaos_document()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#deforaos_document_git
|
||||||
|
_deforaos_document_git()
|
||||||
|
{
|
||||||
|
SRC="DeforaOS.git"
|
||||||
|
|
||||||
|
#checkout tree if necessary
|
||||||
|
if [ ! -d "$SRC" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Checking out Git repository $SRC:"
|
||||||
|
$GIT clone "$GITROOT" "$SRC" > "$DEVNULL" || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
#document tree
|
||||||
|
echo ""
|
||||||
|
echo "Documenting Git repository $SRC:"
|
||||||
|
|
||||||
|
#manual pages
|
||||||
|
echo ""
|
||||||
|
echo " * manual pages"
|
||||||
|
(cd "$SRC/Library/Documentation/src/DeforaOS Manual Pages" &&
|
||||||
|
$CONFIGURE &&
|
||||||
|
$MAKE &&
|
||||||
|
$MKDIR -- "$DESTDIR/htdocs/doc/manual" &&
|
||||||
|
$FIND "doc/manual" -name "*.html" -exec \
|
||||||
|
$INSTALL -- {} "$DESTDIR/htdocs/{}" \;)
|
||||||
|
|
||||||
|
#erase temporary data
|
||||||
|
$RM -r "$ROOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: deforaos-document.sh [-O name=value...]" 1>&2
|
echo "Usage: deforaos-document.sh [-C | -g][-O name=value...]" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
#parse options
|
#parse options
|
||||||
while getopts "O:" name; do
|
document=_deforaos_document_cvs
|
||||||
|
while getopts "CgO:" name; do
|
||||||
case "$name" in
|
case "$name" in
|
||||||
|
C)
|
||||||
|
document=_deforaos_document_cvs
|
||||||
|
;;
|
||||||
|
g)
|
||||||
|
document=_deforaos_document_git
|
||||||
|
;;
|
||||||
O)
|
O)
|
||||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
;;
|
;;
|
||||||
|
@ -114,5 +161,4 @@ if [ $# -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
[ -n "$ROOT" ] || ROOT=$(mktemp -d -p "$HOME" "temp.XXXXXX")
|
[ -n "$ROOT" ] || ROOT=$(mktemp -d -p "$HOME" "temp.XXXXXX")
|
||||||
[ -n "$ROOT" ] || exit 2
|
[ -n "$ROOT" ] || exit 2
|
||||||
[ -n "$SRC" ] || SRC="$ROOT/$MODULE"
|
$document 2>&1 | $MAIL -s "Daily CVS documentation: $DATE" "$EMAIL"
|
||||||
_deforaos_document 2>&1 | $MAIL -s "Daily CVS documentation: $DATE" "$EMAIL"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user