| 
									
										
										
										
											2011-03-25 20:56:25 +01: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 03:23:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-29 16:51:11 +02:00
										 |  |  | # exit on any error | 
					
						
							| 
									
										
										
										
											2011-03-29 18:12:19 +02:00
										 |  |  | #set -e | 
					
						
							| 
									
										
										
										
											2011-03-29 16:51:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-20 03:23:13 +01:00
										 |  |  | # Manpage and HTML | 
					
						
							| 
									
										
										
										
											2011-09-26 20:14:04 +02:00
										 |  |  | A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8" | 
					
						
							| 
									
										
										
										
											2011-09-27 00:12:11 +02:00
										 |  |  | A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8" | 
					
						
							| 
									
										
										
										
											2011-02-26 11:46:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-25 20:49:09 +01:00
										 |  |  | # Developer webbase | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  | WEBDIR=$HOME/niconetz | 
					
						
							| 
									
										
										
										
											2011-03-21 14:00:00 +01:00
										 |  |  | WEBBASE=software/cdist | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  | WEBPAGE=${WEBBASE}.mdwn | 
					
						
							| 
									
										
										
										
											2011-03-21 14:00:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 10:21:10 +01:00
										 |  |  | # Documentation | 
					
						
							| 
									
										
										
										
											2011-03-05 11:36:02 +01:00
										 |  |  | MANDIR=doc/man | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  | MAN1DSTDIR=${MANDIR}/man1 | 
					
						
							|  |  |  | MAN7DSTDIR=${MANDIR}/man7 | 
					
						
							| 
									
										
										
										
											2011-05-10 16:23:59 +02:00
										 |  |  | SPEECHESDIR=doc/speeches | 
					
						
							| 
									
										
										
										
											2011-03-09 08:53:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  | case "$1" in | 
					
						
							|  |  |  |    man) | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |       set -e | 
					
						
							| 
									
										
										
										
											2011-03-25 22:54:17 +01:00
										 |  |  |       "$0" mangen | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |       "$0" mantype | 
					
						
							|  |  |  |       "$0" manbuild | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    manbuild) | 
					
						
							| 
									
										
										
										
											2011-03-29 23:52:31 +02:00
										 |  |  |       trap abort INT | 
					
						
							|  |  |  |       abort() { | 
					
						
							|  |  |  |          kill 0 | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       for section in 1 7; do | 
					
						
							|  |  |  |          for src in ${MANDIR}/man${section}/*.text; do | 
					
						
							|  |  |  |             manpage="${src%.text}.$section" | 
					
						
							|  |  |  |             if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then | 
					
						
							| 
									
										
										
										
											2011-04-01 11:12:15 +02:00
										 |  |  |                echo "Compiling man page for $src" | 
					
						
							| 
									
										
										
										
											2011-03-31 20:46:58 +02:00
										 |  |  |                $A2XM "$src" | 
					
						
							| 
									
										
										
										
											2011-03-29 23:52:31 +02:00
										 |  |  |             fi | 
					
						
							|  |  |  |             htmlpage="${src%.text}.html" | 
					
						
							|  |  |  |             if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then | 
					
						
							| 
									
										
										
										
											2011-04-01 11:12:15 +02:00
										 |  |  |                echo "Compiling html page for $src" | 
					
						
							| 
									
										
										
										
											2011-03-29 23:52:31 +02:00
										 |  |  |                $A2XH "$src" | 
					
						
							|  |  |  |             fi | 
					
						
							|  |  |  |          done | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |       done | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    mantype) | 
					
						
							| 
									
										
										
										
											2011-03-25 22:54:17 +01:00
										 |  |  | 	   for mansrc in conf/type/*/man.text; do | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |          dst="$(echo $mansrc | sed -e 's;conf/;cdist-;'  -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |          ln -sf "../../../$mansrc" "$dst" | 
					
						
							|  |  |  |       done | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    mangen) | 
					
						
							|  |  |  |       ${MANDIR}/cdist-reference.text.sh | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-29 16:52:53 +02:00
										 |  |  |    release) | 
					
						
							|  |  |  |       "$0" clean && "$0" man && "$0" web | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-29 20:24:49 +02:00
										 |  |  |    speeches) | 
					
						
							| 
									
										
										
										
											2011-05-10 16:23:59 +02:00
										 |  |  |       cd "$SPEECHESDIR" | 
					
						
							|  |  |  |       for speech in *tex; do | 
					
						
							| 
									
										
										
										
											2011-07-26 20:01:42 +02:00
										 |  |  |          pdflatex "$speech" | 
					
						
							|  |  |  |          pdflatex "$speech" | 
					
						
							|  |  |  |          pdflatex "$speech" | 
					
						
							| 
									
										
										
										
											2011-04-29 20:24:49 +02:00
										 |  |  |       done | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  |        | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |    web) | 
					
						
							|  |  |  |       cp README ${WEBDIR}/${WEBPAGE} | 
					
						
							| 
									
										
										
										
											2011-09-13 22:42:47 +02:00
										 |  |  |       rm -rf ${WEBDIR}/${WEBBASE}/man  | 
					
						
							| 
									
										
										
										
											2011-09-13 22:46:15 +02:00
										 |  |  |       mkdir -p ${WEBDIR}/${WEBBASE}/man/man1 ${WEBDIR}/${WEBBASE}/man/man7 | 
					
						
							| 
									
										
										
										
											2011-09-13 22:42:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-10 16:23:59 +02:00
										 |  |  |       rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-13 22:42:47 +02:00
										 |  |  |       cp ${MAN1DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man/man1 | 
					
						
							|  |  |  |       cp ${MAN7DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man/man7 | 
					
						
							| 
									
										
										
										
											2011-05-10 16:23:59 +02:00
										 |  |  |       cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches | 
					
						
							|  |  |  |        | 
					
						
							| 
									
										
										
										
											2011-04-06 21:01:27 +02:00
										 |  |  |       git describe > ${WEBDIR}/${WEBBASE}/man/VERSION | 
					
						
							| 
									
										
										
										
											2011-05-10 16:23:59 +02:00
										 |  |  |       cd ${WEBDIR} && git add ${WEBBASE} | 
					
						
							| 
									
										
										
										
											2011-03-25 22:13:07 +01:00
										 |  |  |       cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} | 
					
						
							|  |  |  |       cd ${WEBDIR} && make pub | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-26 21:56:19 +02:00
										 |  |  |    p|pu|pub) | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |       git push --mirror | 
					
						
							|  |  |  |       git push --mirror github | 
					
						
							| 
									
										
										
										
											2011-10-16 16:05:58 +02:00
										 |  |  |       git push --mirror sf | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |    clean) | 
					
						
							| 
									
										
										
										
											2011-04-05 23:27:51 +02:00
										 |  |  |       rm -f ${MAN7DSTDIR}/cdist-reference.text | 
					
						
							| 
									
										
										
										
											2011-03-29 18:12:19 +02:00
										 |  |  |       find "${MANDIR}" -mindepth 2 -type l \ | 
					
						
							|  |  |  |          -o -name "*.1" \ | 
					
						
							|  |  |  |          -o -name "*.7" \ | 
					
						
							|  |  |  |          -o -name "*.html" \ | 
					
						
							|  |  |  |          -o -name "*.xml" \ | 
					
						
							|  |  |  |       | xargs rm -f | 
					
						
							| 
									
										
										
										
											2011-03-25 22:10:52 +01:00
										 |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 15:37:39 +02:00
										 |  |  |    test) | 
					
						
							| 
									
										
										
										
											2011-10-07 17:39:04 +02:00
										 |  |  |       shift # skip t | 
					
						
							| 
									
										
										
										
											2011-10-14 14:19:18 +02:00
										 |  |  |       export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 15:37:39 +02:00
										 |  |  |       if [ $# -lt 1 ]; then | 
					
						
							| 
									
										
										
										
											2011-10-14 14:19:18 +02:00
										 |  |  |          python3 -m cdist.test | 
					
						
							|  |  |  |       else | 
					
						
							| 
									
										
										
										
											2011-10-07 17:39:04 +02:00
										 |  |  |          python3 -m unittest "$@" | 
					
						
							| 
									
										
										
										
											2011-10-14 14:19:18 +02:00
										 |  |  |       fi | 
					
						
							| 
									
										
										
										
											2011-10-02 15:56:27 +02:00
										 |  |  |    ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-25 21:04:26 +01:00
										 |  |  |    *) | 
					
						
							|  |  |  |       echo '' | 
					
						
							|  |  |  |       echo 'Welcome to cdist!' | 
					
						
							|  |  |  |       echo '' | 
					
						
							|  |  |  |       echo 'Here are the possible targets:' | 
					
						
							|  |  |  |       echo '' | 
					
						
							|  |  |  |       echo '	man: Build manpages (requires Asciidoc)' | 
					
						
							|  |  |  |       echo '	clean: Remove build stuff' | 
					
						
							|  |  |  |       echo '' | 
					
						
							|  |  |  |       echo '' | 
					
						
							|  |  |  |       echo "Unknown target, \"$1\"" >&2 | 
					
						
							|  |  |  |       exit 1 | 
					
						
							|  |  |  |    ;; | 
					
						
							|  |  |  | esac |