2011-03-25 19:56:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
|
|
|
#
|
|
|
|
# This file is part of cdist.
|
|
|
|
#
|
|
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# cdist is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Push a directory to a target, both sides have the same name (i.e. explorers)
|
|
|
|
# or
|
|
|
|
# Pull a directory from a target, both sides have the same name (i.e. explorers)
|
|
|
|
#
|
2011-03-20 02:23:13 +00:00
|
|
|
|
|
|
|
# Manpage and HTML
|
2011-03-25 20:04:26 +00:00
|
|
|
A2XM="a2x -f manpage --no-xmllint"
|
|
|
|
A2XH="a2x -f xhtml --no-xmllint"
|
2011-02-26 10:46:52 +00:00
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
# Developer webbase
|
2011-03-25 20:04:26 +00:00
|
|
|
WEBDIR=$HOME/niconetz
|
2011-03-21 13:00:00 +00:00
|
|
|
WEBBASE=software/cdist
|
2011-03-25 20:04:26 +00:00
|
|
|
WEBPAGE=${WEBBASE}.mdwn
|
2011-03-21 13:00:00 +00:00
|
|
|
|
2011-03-16 09:21:10 +00:00
|
|
|
# Documentation
|
2011-03-05 10:36:02 +00:00
|
|
|
MANDIR=doc/man
|
2011-03-25 20:04:26 +00:00
|
|
|
MAN1DSTDIR=${MANDIR}/man1
|
|
|
|
MAN7DSTDIR=${MANDIR}/man7
|
2011-03-09 07:53:19 +00:00
|
|
|
|
2011-03-24 16:41:20 +00:00
|
|
|
MAN1SRC= \
|
2011-03-25 20:04:26 +00:00
|
|
|
${MANDIR}/cdist-code-run.text \
|
|
|
|
${MANDIR}/cdist-code-run-all.text \
|
|
|
|
${MANDIR}/cdist-config.text \
|
|
|
|
${MANDIR}/cdist-dir.text \
|
|
|
|
${MANDIR}/cdist-env.text \
|
|
|
|
${MANDIR}/cdist-explorer-run-global.text \
|
|
|
|
${MANDIR}/cdist-deploy-to.text \
|
|
|
|
${MANDIR}/cdist-explorer.text \
|
|
|
|
${MANDIR}/cdist-manifest.text \
|
|
|
|
${MANDIR}/cdist-manifest-run.text \
|
|
|
|
${MANDIR}/cdist-manifest-run-init.text \
|
|
|
|
${MANDIR}/cdist-manifest-run-all.text \
|
|
|
|
${MANDIR}/cdist-object-explorer-all.text \
|
|
|
|
${MANDIR}/cdist-object-gencode.text \
|
|
|
|
${MANDIR}/cdist-object-gencode-all.text \
|
|
|
|
${MANDIR}/cdist-remote-explorer-run.text \
|
|
|
|
${MANDIR}/cdist-run-remote.text \
|
|
|
|
${MANDIR}/cdist-type-build-emulation.text \
|
|
|
|
${MANDIR}/cdist-type-emulator.text \
|
|
|
|
${MANDIR}/cdist-type-template.text
|
|
|
|
|
|
|
|
MAN7SRC=${MANDIR}/cdist.text \
|
|
|
|
${MANDIR}/cdist-best-practise.text \
|
|
|
|
${MANDIR}/cdist-hacker.text \
|
|
|
|
${MANDIR}/cdist-quickstart.text \
|
|
|
|
${MANDIR}/cdist-reference.text \
|
|
|
|
${MANDIR}/cdist-stages.text \
|
|
|
|
${MANDIR}/cdist-type.text \
|
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
man)
|
|
|
|
for mansrc in ${MAN1SRC} ${MAN7SRC}; do
|
|
|
|
ln -sf ../../../$mansrc ${MAN1DSTDIR};
|
|
|
|
done
|
|
|
|
for mansrc in ${MAN7TYPESRC}; do
|
|
|
|
dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"
|
|
|
|
ln -sf ../../../$$mansrc $$dst
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
|
|
|
|
web)
|
|
|
|
cp README ${WEBDIR}/${WEBPAGE}
|
|
|
|
rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man
|
|
|
|
cp -r $(MANHTMLDIR)/* ${WEBDIR}/${WEBBASE}/man
|
|
|
|
cd ${WEBDIR} && git add ${WEBBASE}/man
|
|
|
|
cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE}
|
|
|
|
cd ${WEBDIR} && make pub
|
|
|
|
;;
|
|
|
|
|
|
|
|
pub)
|
|
|
|
git push --mirror
|
|
|
|
git push --mirror github
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo 'Welcome to cdist!'
|
|
|
|
echo ''
|
|
|
|
echo 'Here are the possible targets:'
|
|
|
|
echo ''
|
|
|
|
echo ' man: Build manpages (requires Asciidoc)'
|
|
|
|
echo ' manhtml: Build html-manpages (requires Asciidoc)'
|
|
|
|
echo ' clean: Remove build stuff'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
echo "Unknown target, \"$1\"" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-03-25 10:17:52 +00:00
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
# Manpages from types
|
2011-03-25 20:04:26 +00:00
|
|
|
MAN7TYPESRC=$(ls conf/type/*/man.text)
|
2011-02-26 19:41:33 +00:00
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
# Source files after linking them
|
2011-03-25 20:04:26 +00:00
|
|
|
MAN1TMPSRC=$(shell ls ${MAN1DSTDIR}/*.text)
|
|
|
|
MAN7TMPSRC=$(shell ls ${MAN7DSTDIR}/*.text)
|
2011-03-25 19:49:09 +00:00
|
|
|
|
|
|
|
# Destination files based on linked files, not static list
|
|
|
|
MAN1DST=$(MAN1TMPSRC:.text=.1)
|
|
|
|
MAN7DST=$(MAN7TMPSRC:.text=.7)
|
|
|
|
MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html)
|
2011-03-25 10:17:52 +00:00
|
|
|
|
2011-02-26 18:37:15 +00:00
|
|
|
################################################################################
|
|
|
|
# User targets
|
|
|
|
#
|
2011-02-19 00:47:10 +00:00
|
|
|
|
2011-02-26 10:51:59 +00:00
|
|
|
|
2011-03-25 10:34:29 +00:00
|
|
|
################################################################################
|
|
|
|
# Documentation
|
|
|
|
#
|
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
# Create manpages
|
|
|
|
man: $(MAN1DST) $(MAN7DST)
|
|
|
|
manhtml: $(MANHTML)
|
2011-03-25 19:31:20 +00:00
|
|
|
|
2011-03-25 19:54:50 +00:00
|
|
|
$(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS)
|
2011-03-25 19:31:20 +00:00
|
|
|
|
2011-03-25 10:34:29 +00:00
|
|
|
# Create output dirs
|
2011-03-25 20:04:26 +00:00
|
|
|
${MAN1DSTDIR} ${MAN7DSTDIR} $(MANHTMLDIR) $(MANTMPDIR):
|
2011-03-25 10:34:29 +00:00
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
# Link source files
|
2011-03-25 20:04:26 +00:00
|
|
|
manlink: ${MAN1SRC} ${MAN7SRC} $(MANTYPE7SRC) $(MANOUTDIRS)
|
2011-03-25 10:17:52 +00:00
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
%.1 %.7: %.text manlink
|
2011-03-24 17:43:08 +00:00
|
|
|
$(A2XM) $*.text
|
2011-02-26 10:51:59 +00:00
|
|
|
|
2011-03-25 18:39:50 +00:00
|
|
|
%.html: %.text manlink
|
2011-03-25 19:49:09 +00:00
|
|
|
$(A2XH) $<
|
2011-03-24 17:43:08 +00:00
|
|
|
|
2011-03-25 20:04:26 +00:00
|
|
|
${MANDIR}/cdist-reference.text: ${MANDIR}/cdist-reference.text.sh
|
|
|
|
${MANDIR}/cdist-reference.text.sh
|
2011-03-09 07:53:19 +00:00
|
|
|
|
2011-02-26 10:51:59 +00:00
|
|
|
clean:
|
2011-03-25 19:49:09 +00:00
|
|
|
rm -rf $(MANOUTDIRS)
|
2011-03-25 20:04:26 +00:00
|
|
|
rm -f ${MANDIR}/cdist-reference.text
|
2011-02-26 10:51:59 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Developer targets
|
|
|
|
#
|
|
|
|
|
|
|
|
test:
|
2011-02-03 12:32:29 +00:00
|
|
|
# ubuntu
|
2010-09-25 10:36:30 +00:00
|
|
|
.rsync lyni@tablett:cdist
|
2011-02-03 12:32:29 +00:00
|
|
|
# redhat
|
2010-09-25 10:36:30 +00:00
|
|
|
.rsync nicosc@free.ethz.ch:cdist
|
2011-02-03 12:32:29 +00:00
|
|
|
# gentoo
|
|
|
|
.rsync nicosc@ru3.inf.ethz.ch:cdist
|