Index: head/textproc/s5/Makefile =================================================================== --- head/textproc/s5/Makefile (revision 491920) +++ head/textproc/s5/Makefile (revision 491921) @@ -1,40 +1,40 @@ # Created by: Peter Pentchev # $FreeBSD$ PORTNAME= s5 PORTVERSION= 1.1 PORTREVISION= 2 CATEGORIES= textproc MASTER_SITES= http://meyerweb.com/eric/tools/s5/v/${PORTVERSION}/ DISTNAME= ${PORTNAME}-${PORTVERSION:S/.//g} MAINTAINER= ports@FreeBSD.org COMMENT= Simple HTML-based presentation system LICENSE= BSD2CLAUSE PD LICENSE_COMB= multi USES= dos2unix zip DOS2UNIX_REGEX= .*\.(css|htc|html|js|txt) NO_ARCH= yes NO_BUILD= yes NO_WRKSUBDIR= yes +SUB_FILES= s5 s5.1 + S5_DIR= ${PREFIX}/share/${PORTNAME} S5_SUBDIRS= pix primer s5-blank ui post-extract: @cd ${WRKSRC} && ${TAR} -xf s5-blank.zip - @${SED} -e "s,/usr/local,${PREFIX}," ${FILESDIR}/s5.sh > ${WRKDIR}/s5 - @${SED} -e "s,/usr/local,${PREFIX}," ${FILESDIR}/s5.1 > ${WRKDIR}/s5.1 @${FIND} ${WRKSRC} -type f -name .DS_Store -delete do-install: @${MKDIR} ${STAGEDIR}${S5_DIR} @(cd ${WRKSRC} && \ ${COPYTREE_SHARE} "*.html ${S5_SUBDIRS}" ${STAGEDIR}${S5_DIR}) ${INSTALL_SCRIPT} ${WRKDIR}/s5 ${STAGEDIR}${PREFIX}/bin/s5 ${INSTALL_MAN} ${WRKDIR}/s5.1 ${STAGEDIR}${MANPREFIX}/man/man1/s5.1 .include Index: head/textproc/s5/files/s5.sh =================================================================== --- head/textproc/s5/files/s5.sh (revision 491920) +++ head/textproc/s5/files/s5.sh (nonexistent) @@ -1,408 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008 Peter Pentchev -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -e - -LOCALBASE='/usr/local' -S5_DIR="${LOCALBASE}/share/s5" -S5_TEMPLATE="${S5_DIR}/s5-blank" -NOOP='' -VERBOSE='' - -CKSUM='cksum' -CKSUM_ARGS='' - -SHADOWDIR='' - -# s5 blank path -# Create a new S5 presentation at the specified path -# -s5_blank() -{ - [ -z "$VERBOSE" ] || echo "s5_blank: path $1" 1>&2 - if [ -z "$1" ]; then - echo 'Usage: s5 blank path' 1>&2 - exit 1 - fi - - if [ -e "$1" ] && ! [ -d "$1/" ]; then - echo "Not a directory: $1" 1>&2 - exit 1 - fi - - [ -z "$VERBOSE" ] || echo "- creating the directory" 1>&2 - [ -e "$1" ] || ${NOOP} mkdir -p "$1" - [ -z "$VERBOSE" ] || echo "- copying files from ${S5_TEMPLATE}" 1>&2 - ${NOOP} cp -Rp ${VERBOSE:+'-v'} "${S5_TEMPLATE}"/ "$1"/ - [ -z "$VERBOSE" ] || echo "- s5_mksum for the initial checksums" 1>&2 - s5_mksum "$1" -} - -# s5_cksum path -# Calculate the checksums of the actual files in path and compare them -# to the ones recorded when the presentation was created -# -s5_cksum() -{ - [ -z "$VERBOSE" ] || echo "s5_cksum: path $1" 1>&2 - if [ -z "$1" ]; then - echo 'Usage: s5 cksum path' 1>&2 - exit 1 - fi - - if ! [ -d "$1/" ]; then - echo "Not a directory: $1" 1>&2 - exit 1 - fi - cksumfile="$1/s5-checksums.txt" - if [ ! -f "$cksumfile" ] || [ ! -r "$cksumfile" ]; then - echo "Invalid checksum file $cksumfile" 1>&2 - exit 1 - fi - - file='' - nofile='' - cksumbad='' - while read cmd args; do - [ -z "$VERBOSE" ] || echo "- read cmd $cmd args $args" 1>&2 - case "$cmd" in - CKSUM_CMD) - [ -z "$VERBOSE" ] || echo " - comparing current command '$CKSUM' with '$args'" 1>&2 - if [ "$CKSUM" != "$args" ]; then - echo "Checksum command mismatch: current '$CKSUM', file recorded with '$args'" 1>&2 - exit 1 - fi - ;; - - CKSUM_ARGS) - [ -z "$VERBOSE" ] || echo " - comparing current args '$CKSUM_ARGS' with '$args'" 1>&2 - if [ "$CKSUM_ARGS" != "$args" ]; then - echo "Checksum arguments mismatch: current '$CKSUM_ARGS', file recorded with '$args'" 1>&2 - exit 1 - fi - ;; - - FILE) - [ -z "$VERBOSE" ] || echo " - handling file $args" 1>&2 - if [ ! -f "$1/$args" ]; then - echo "Missing file described in the checksum records: $args" 1>&2 - nofile=1 - cksumbad=1 - else - file="$args" - nofile='' - fi - ;; - - CKSUM) - if [ -z "$nofile" ]; then - if [ -z "$file" ]; then - echo "Checksum without filename" 1>&2 - exit 1 - fi - [ -z "$VERBOSE" ] || echo " - about to check $file for $args" 1>&2 - o=`cd "$1" && $CKSUM $CKSUM_ARGS "$file"` - [ -z "$VERBOSE" ] || echo " - got checksum $o" 1>&2 - if [ "$o" != "$args" ]; then - echo "Bad checksum for file $file" 1>&2 - cksumbad=1 - else - if [ -n "$SHADOWDIR" ]; then - d=`dirname "$file"` - mkdir -p "$SHADOWDIR"/t/"$d" - touch "$SHADOWDIR"/t/"$file" - fi - fi - else - [ -z "$VERBOSE" ] || echo " - skipping checksum $args" 1>&2 - fi - ;; - - *) - echo "Unsupported checksum keyword $cmd" 1>&2 - exit 1 - ;; - esac - done < "$cksumfile" - - if [ -n "$cksumbad" ]; then - echo "Some files failed the checksum check" 1>&2 - exit 1 - fi - [ -z "$VERBOSE" ] || echo "- all fine!" 1>&2 -} - -# s5 mksum path -# Calculate the checksums of the stock S5 template files and record -# them into the S5 presentation at path -# -s5_mksum() -{ - [ -z "$VERBOSE" ] || echo "s5_mksum: path $1" 1>&2 - if [ -z "$1" ]; then - echo 'Usage: s5 mksum path' 1>&2 - exit 1 - fi - - if [ -z "$NOOP" ] && ! [ -d "$1/" ]; then - echo "Not a directory: $1" 1>&2 - exit 1 - fi - - cksumfile="$1/s5-checksums.txt" - [ -z "$VERBOSE" ] || echo "- from ${S5_TEMPLATE} to $cksumfile" 1>&2 - (cd "${S5_TEMPLATE}" && \ - echo "CKSUM_CMD $CKSUM" && \ - echo "CKSUM_ARGS $CKSUM_ARGS" && \ - find . -type f | sed -e 's,^\./,,' | while read f; do - s5_mksum_single "$f" - done) | if [ -z "$NOOP" ]; then - cat > "$cksumfile" - if [ -n "$VERBOSE" ]; then - cnt=`egrep -ce '^CKSUM ' "$cksumfile"` - echo "- $cnt checksums recorded into $cksumfile" 1>&2 - fi - else - ${NOOP} "Would write checksums to $cksumfile" - cnt=0 - while read line; do - [ -z "$VERBOSE" ] || ${NOOP} "$line" - if expr "$line" : 'CKSUM ' > /dev/null; then - cnt=`expr "$cnt" + 1` - fi - done - ${NOOP} "Would record checksums for $cnt files" - fi -} - -# Internal routine for calculating the checksum of a single file -s5_mksum_single() -{ - o=`$CKSUM $CKSUM_ARGS "$1"` - echo "FILE $1" - echo "CKSUM $o" -} - -# s5 help -# Display the help message and exit -# -s5_help() -{ - cat << EOF -Usage: s5 [-hNv] [-T template] command [args...] - -The available command-line options are: - -h display this help message and exit - -N no-op mode, just display the commands without executing them - -T template directory, default /usr/local/share/s5/s5-blank - -v verbose operation, display diagnostic information - -The available commands are: - blank path - Create a new S5 presentation at the specified path - - check path - Alias for cksum - - cksum path - Verify the checksums of the S5 presentation at path - - create path - Alias for blank - - help - Display this help message and exit - - mksum path - Store the template checksums at the specified path - - new path - Alias for blank - - update path - Update an S5 presentation with the new S5 template files - - usage - Alias for help - - verify path - Alias for cksum -EOF -} - -# Internal routine: create a temporary directory for tracking checksum files -s5_shadowdir_create() -{ - d=`mktemp -d -t s5tool` - if [ ! -d "$d" ]; then - echo "Could not create a shadow directory using mktemp" 1>&2 - exit 1 - fi - chmod 700 "$d" - trap s5_shadowdir_cleanup EXIT HUP INT QUIT TERM PIPE - SHADOWDIR="$d" -} - -# Internal routine: clean up the temporary directory at exit time -s5_shadowdir_cleanup() -{ - if [ -n "$SHADOWDIR" ] && [ -d "$SHADOWDIR" ] && [ -w "$SHADOWDIR" ]; then - rm -rf "$SHADOWDIR"/t - rmdir "$SHADOWDIR" - fi -} - -# s5_update path -# Update the S5 presentation at the specified path with files from -# the template directory, but only if the S5 presentation has not -# been modified in the meantime -# -s5_update() -{ - [ -z "$VERBOSE" ] || echo "s5_update: path $1" 1>&2 - s5_shadowdir_create - s5_cksum "$1" - - [ -z "$VERBOSE" ] || echo "s5_update: checking for new files" 1>&2 - (cd "$S5_TEMPLATE" && find . -type f) | ( - noupdate='' - while read f; do - [ -z "$VERBOSE" ] || echo "- $f" 1>&2 - if [ -f "$1/$f" ]; then - [ -z "$VERBOSE" ] || echo " - exists in the working directory" 1>&2 - if cmp -s "$S5_TEMPLATE/$f" "$1/$f"; then - [ -z "$VERBOSE" ] || echo " - the files are the same :)" 1>&2 - else - if [ ! -f "$SHADOWDIR"/t/"$f" ]; then - echo "File in template and working dir, but not part of the previous template: $f" 1>&2 - noupdate=1 - fi - fi - fi - done - if [ -n "$noupdate" ]; then - echo "Not proceeding with the update" 1>&2 - exit 1 - fi - ) - - [ -z "$VERBOSE" ] || echo "s5_update: about to delete files" 1>&2 - (cd "$SHADOWDIR"/t && find . -type f) | while read f; do - if [ ! -f "$S5_TEMPLATE/$f" ]; then - ${NOOP} rm ${VERBOSE:+'-v'} "$1/$f" - fi - done - - [ -z "$VERBOSE" ] || echo "s5_update: about to copy files" 1>&2 - (cd "$S5_TEMPLATE" && find . -mindepth 1 -type d) | while read d; do - if [ ! -d "$1/$d" ]; then - ${NOOP} mkdir -p ${VERBOSE:+'-v'} "$1/$d" - else - [ -z "$VERBOSE" ] || echo "- existing dir $d" 1>&2 - fi - done - (cd "$S5_TEMPLATE" && find . -type f) | while read f; do - ${NOOP} cp -p ${VERBOSE:+'-v'} "$S5_TEMPLATE/$f" "$1/$f" - done - - [ -z "$VERBOSE" ] || echo "s5_update: invoking s5_mksum" 1>&2 - s5_mksum "$1" -} - -# Process the command-line options -while getopts 'hNT:v' o; do - case "$o" in - h) - s5_help - exit 0 - ;; - - N) - NOOP='echo' - ;; - - T) - S5_TEMPLATE="$OPTARG" - ;; - - v) - VERBOSE="${VERBOSE}v" - ;; - - *) - [ "$o" = '?' ] || echo "Unrecognized option '$o'" 1>&2 - s5_help - exit 1 - ;; - esac -done -shift `expr "$OPTIND" - 1` - -# Treat a simple "s5" invocation as a usage request -if [ -z "$1" ]; then - s5_help - exit -fi - -# Okay, we have some a command... -[ -z "$VERBOSE" ] || echo "Parsing a command: $1" 1>&2 -case "$1" in - # b(lank), cr(eate), n(ew) - b|bl|bla|blan|blank|cr|cre|crea|creat|create|n|ne|new) - shift - s5_blank "$1" - ;; - - # ch(eck), ck(sum), v(erify) - ch|che|chec|check|ck|cks|cksu|cksum|v|ve|ver|verify) - shift - s5_cksum "$1" - ;; - - # h(elp), us(age) - h|he|hel|help|us|usa|usag|usage) - shift - s5_help - ;; - - # m(ksum) - m|mk|mks|mksu|mksum) - shift - s5_mksum "$1" - ;; - - # up(date) - up|upd|upda|updat|update) - shift - s5_update "$1" - ;; - - *) - echo "Unrecognized s5 command $1" 1>&2 - s5_help 1>&2 - exit 1 - ;; -esac Property changes on: head/textproc/s5/files/s5.sh ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/textproc/s5/files/s5.1 =================================================================== --- head/textproc/s5/files/s5.1 (revision 491920) +++ head/textproc/s5/files/s5.1 (nonexistent) @@ -1,230 +0,0 @@ -.\" Copyright (c) 2008 Peter Pentchev -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.Dd June 12, 2008 -.Dt S5 1 -.Os -.Sh NAME -.Nm s5 -.Nd set up and update S5 presentations -.Sh SYNOPSIS -.Nm -.Op Fl Nv -.Op Fl T Ar template -.Cm blank -.Ar path -.Nm -.Op Fl Nv -.Op Fl T Ar template -.Cm cksum -.Ar path -.Nm -.Op Fl Nv -.Op Fl T Ar template -.Cm mksum -.Ar path -.Nm -.Op Fl Nv -.Op Fl T Ar template -.Cm update -.Ar path -.Pp -.Nm -.Fl h -.Nm -.Cm help -.Sh DESCRIPTION -The -.Nm -tool eases the creation of presentation slides using the -.Dq Simple Standards-based Slide Show System . -It may be used to create a working copy of a template directory or, later, -to update the working copy after the template has changed over time. -.Pp -The -.Nm -tool supports the following command-line options: -.Bl -tag -width indent -.It Fl h -Display a short help text and exit. -.It Fl N -No-operation mode; just display the commands without executing them. -.It Fl T Ar template -Specify the template directory instead of the default -.Pa /usr/local/share/s5/s5-blank -.It Fl v -Verbose operation; display diagnostic information. -.El -.Pp -The -.Nm -tool supports the following actions: -.Bl -tag -width indent -.It Cm blank Ar path -Aliases: -.Cm create , -.Cm new -.Pp -Copy the template directory into the directory specified by -.Ar path , -creating it if necessary. -.It Cm cksum Ar path -Aliases: -.Cm check , -.Cm verify -.Pp -Verify the checksums recorded for the S5 presentation files in -the directory specified by -.Ar path . -The -.Nm -utility reports both files that have been modified (fail the checksum -check) and files that no longer exist yet have checksums recorded. -.It Cm help -Alias: -.Cm usage -.Pp -Display a short help message and exit. -.It Cm mksum Ar path -Record the template checksums into a file in a directory specified by -.Ar path . -Users should never really have to execute this by hand, since it is -done internally as part of the -.Cm blank -and -.Cm update -command processing. -.It Cm update Ar path -Update the S5 presentation files in the directory specified by -.Ar path -with the new versions in the S5 template directory. -.Pp -Before updating, the -.Nm -utility verifies the checksums of the files in the -.Pa path -directory, and terminates if a mismatch is found. -After that, -.Nm -checks for any files that exist in both the new template and in the -.Ar path -directory, but are not recorded in the checksum file (i.e. have been -placed in -.Ar path -by hand after the last -.Nm Cm blank -or -.Nm Cm update -run) and terminates if any such files differ. -.Pp -If all these checks are successful, the -.Nm -utility copies the template files over those in -.Ar path , -overwriting any existing files and retaining any files that do not -exist in the template directory. -.El -.Sh FILES -.\" FIXME: describe any configuration files when they show up -The -.Nm -utility stores the checksums of blank S5 presentations into a file named -.Pa s5-checksums.txt -into the presentation directory. -This is a simple text file with lines containing of a keyword and values. -The keywords that the -.Nm -utility currently generates and parses are as follows: -.Bl -tag -width indent -.It Cm CKSUM_CMD Ar checksum-program -The name of the checksum program to use; the default is -.Xr cksum 1 . -.It Cm CKSUM_ARGS Op Ar [argument...] -The arguments (if any) passed to the checksum program as defined by the -.Cm CKSUM_CMD -line. -The default is an empty string, no arguments passed. -.It Cm FILE Ar filename -The name of the file that the following -.Cm CKSUM -line refers to. -.It Cm CKSUM Ar checksum-line-text -The output of the checksum command as specified by -.Cm CKSUM_CMD -and -.Cm CKSUM_ARGS -conflated into a single line. -.El -.Sh EXAMPLES -Start a brand new presentation: -.Pp -.Dl s5 blank ~/txt/openfest/2006/gnupg -.Pp -Verify if any of the S5 files in the presentation have been modified: -.Pp -.Dl s5 cksum gnupg/ -.Pp -Do the same, but display verbose information about the lines read from -the checksums file and the files verified: -.Pp -.Dl s5 -v cksum gnupg/ -.Pp -Update the S5 presentation files after installing a new system-wide -version of the S5 template: -.Pp -.Dl s5 update gnupg/ -.Pp -Store the checksums of the S5 template files -.Em ( not -the real files in the presentation directory!) into the -.Pa s5-checksums.txt -file in the -.Pa gnupg/ -directory; this is actually redundant, as it is done as part of the -.Nm Cm blank -invocation: -.Pp -.Dl s5 mksum gnupg/ -.Sh SEE ALSO -The home page of the Simple Standards-based Slide Show System: -.Li http://www.meyerweb.com/eric/tools/s5/ -.Sh HISTORY -The Simple Standards-based Slide Show System was written by -.An Eric Meyer -based on earlier work by -.An Tantek \[,C]elik . -The -.Nm -tool and this manual page were written by -.An Peter Pentchev -in 2008. -.Sh AUTHORS -.An Eric Meyer -.Aq eric@meyerweb.com -.An Tantek \[,C]elik -.Aq tantek@tantek.com -.An Peter Pentchev -.Aq roam@ringlet.net -.Sh BUGS -No configuration files are parsed yet. Property changes on: head/textproc/s5/files/s5.1 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/textproc/s5/files/s5.1.in =================================================================== --- head/textproc/s5/files/s5.1.in (nonexistent) +++ head/textproc/s5/files/s5.1.in (revision 491921) @@ -0,0 +1,230 @@ +.\" Copyright (c) 2008 Peter Pentchev +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 12, 2008 +.Dt S5 1 +.Os +.Sh NAME +.Nm s5 +.Nd set up and update S5 presentations +.Sh SYNOPSIS +.Nm +.Op Fl Nv +.Op Fl T Ar template +.Cm blank +.Ar path +.Nm +.Op Fl Nv +.Op Fl T Ar template +.Cm cksum +.Ar path +.Nm +.Op Fl Nv +.Op Fl T Ar template +.Cm mksum +.Ar path +.Nm +.Op Fl Nv +.Op Fl T Ar template +.Cm update +.Ar path +.Pp +.Nm +.Fl h +.Nm +.Cm help +.Sh DESCRIPTION +The +.Nm +tool eases the creation of presentation slides using the +.Dq Simple Standards-based Slide Show System . +It may be used to create a working copy of a template directory or, later, +to update the working copy after the template has changed over time. +.Pp +The +.Nm +tool supports the following command-line options: +.Bl -tag -width indent +.It Fl h +Display a short help text and exit. +.It Fl N +No-operation mode; just display the commands without executing them. +.It Fl T Ar template +Specify the template directory instead of the default +.Pa %%PREFIX%%/share/s5/s5-blank +.It Fl v +Verbose operation; display diagnostic information. +.El +.Pp +The +.Nm +tool supports the following actions: +.Bl -tag -width indent +.It Cm blank Ar path +Aliases: +.Cm create , +.Cm new +.Pp +Copy the template directory into the directory specified by +.Ar path , +creating it if necessary. +.It Cm cksum Ar path +Aliases: +.Cm check , +.Cm verify +.Pp +Verify the checksums recorded for the S5 presentation files in +the directory specified by +.Ar path . +The +.Nm +utility reports both files that have been modified (fail the checksum +check) and files that no longer exist yet have checksums recorded. +.It Cm help +Alias: +.Cm usage +.Pp +Display a short help message and exit. +.It Cm mksum Ar path +Record the template checksums into a file in a directory specified by +.Ar path . +Users should never really have to execute this by hand, since it is +done internally as part of the +.Cm blank +and +.Cm update +command processing. +.It Cm update Ar path +Update the S5 presentation files in the directory specified by +.Ar path +with the new versions in the S5 template directory. +.Pp +Before updating, the +.Nm +utility verifies the checksums of the files in the +.Pa path +directory, and terminates if a mismatch is found. +After that, +.Nm +checks for any files that exist in both the new template and in the +.Ar path +directory, but are not recorded in the checksum file (i.e. have been +placed in +.Ar path +by hand after the last +.Nm Cm blank +or +.Nm Cm update +run) and terminates if any such files differ. +.Pp +If all these checks are successful, the +.Nm +utility copies the template files over those in +.Ar path , +overwriting any existing files and retaining any files that do not +exist in the template directory. +.El +.Sh FILES +.\" FIXME: describe any configuration files when they show up +The +.Nm +utility stores the checksums of blank S5 presentations into a file named +.Pa s5-checksums.txt +into the presentation directory. +This is a simple text file with lines containing of a keyword and values. +The keywords that the +.Nm +utility currently generates and parses are as follows: +.Bl -tag -width indent +.It Cm CKSUM_CMD Ar checksum-program +The name of the checksum program to use; the default is +.Xr cksum 1 . +.It Cm CKSUM_ARGS Op Ar [argument...] +The arguments (if any) passed to the checksum program as defined by the +.Cm CKSUM_CMD +line. +The default is an empty string, no arguments passed. +.It Cm FILE Ar filename +The name of the file that the following +.Cm CKSUM +line refers to. +.It Cm CKSUM Ar checksum-line-text +The output of the checksum command as specified by +.Cm CKSUM_CMD +and +.Cm CKSUM_ARGS +conflated into a single line. +.El +.Sh EXAMPLES +Start a brand new presentation: +.Pp +.Dl s5 blank ~/txt/openfest/2006/gnupg +.Pp +Verify if any of the S5 files in the presentation have been modified: +.Pp +.Dl s5 cksum gnupg/ +.Pp +Do the same, but display verbose information about the lines read from +the checksums file and the files verified: +.Pp +.Dl s5 -v cksum gnupg/ +.Pp +Update the S5 presentation files after installing a new system-wide +version of the S5 template: +.Pp +.Dl s5 update gnupg/ +.Pp +Store the checksums of the S5 template files +.Em ( not +the real files in the presentation directory!) into the +.Pa s5-checksums.txt +file in the +.Pa gnupg/ +directory; this is actually redundant, as it is done as part of the +.Nm Cm blank +invocation: +.Pp +.Dl s5 mksum gnupg/ +.Sh SEE ALSO +The home page of the Simple Standards-based Slide Show System: +.Li http://www.meyerweb.com/eric/tools/s5/ +.Sh HISTORY +The Simple Standards-based Slide Show System was written by +.An Eric Meyer +based on earlier work by +.An Tantek \[,C]elik . +The +.Nm +tool and this manual page were written by +.An Peter Pentchev +in 2008. +.Sh AUTHORS +.An Eric Meyer +.Aq eric@meyerweb.com +.An Tantek \[,C]elik +.Aq tantek@tantek.com +.An Peter Pentchev +.Aq roam@ringlet.net +.Sh BUGS +No configuration files are parsed yet. Property changes on: head/textproc/s5/files/s5.1.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/textproc/s5/files/s5.in =================================================================== --- head/textproc/s5/files/s5.in (nonexistent) +++ head/textproc/s5/files/s5.in (revision 491921) @@ -0,0 +1,408 @@ +#!/bin/sh +# +# Copyright (c) 2008 Peter Pentchev +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +LOCALBASE='%%PREFIX%%' +S5_DIR="${LOCALBASE}/share/s5" +S5_TEMPLATE="${S5_DIR}/s5-blank" +NOOP='' +VERBOSE='' + +CKSUM='cksum' +CKSUM_ARGS='' + +SHADOWDIR='' + +# s5 blank path +# Create a new S5 presentation at the specified path +# +s5_blank() +{ + [ -z "$VERBOSE" ] || echo "s5_blank: path $1" 1>&2 + if [ -z "$1" ]; then + echo 'Usage: s5 blank path' 1>&2 + exit 1 + fi + + if [ -e "$1" ] && ! [ -d "$1/" ]; then + echo "Not a directory: $1" 1>&2 + exit 1 + fi + + [ -z "$VERBOSE" ] || echo "- creating the directory" 1>&2 + [ -e "$1" ] || ${NOOP} mkdir -p "$1" + [ -z "$VERBOSE" ] || echo "- copying files from ${S5_TEMPLATE}" 1>&2 + ${NOOP} cp -Rp ${VERBOSE:+'-v'} "${S5_TEMPLATE}"/ "$1"/ + [ -z "$VERBOSE" ] || echo "- s5_mksum for the initial checksums" 1>&2 + s5_mksum "$1" +} + +# s5_cksum path +# Calculate the checksums of the actual files in path and compare them +# to the ones recorded when the presentation was created +# +s5_cksum() +{ + [ -z "$VERBOSE" ] || echo "s5_cksum: path $1" 1>&2 + if [ -z "$1" ]; then + echo 'Usage: s5 cksum path' 1>&2 + exit 1 + fi + + if ! [ -d "$1/" ]; then + echo "Not a directory: $1" 1>&2 + exit 1 + fi + cksumfile="$1/s5-checksums.txt" + if [ ! -f "$cksumfile" ] || [ ! -r "$cksumfile" ]; then + echo "Invalid checksum file $cksumfile" 1>&2 + exit 1 + fi + + file='' + nofile='' + cksumbad='' + while read cmd args; do + [ -z "$VERBOSE" ] || echo "- read cmd $cmd args $args" 1>&2 + case "$cmd" in + CKSUM_CMD) + [ -z "$VERBOSE" ] || echo " - comparing current command '$CKSUM' with '$args'" 1>&2 + if [ "$CKSUM" != "$args" ]; then + echo "Checksum command mismatch: current '$CKSUM', file recorded with '$args'" 1>&2 + exit 1 + fi + ;; + + CKSUM_ARGS) + [ -z "$VERBOSE" ] || echo " - comparing current args '$CKSUM_ARGS' with '$args'" 1>&2 + if [ "$CKSUM_ARGS" != "$args" ]; then + echo "Checksum arguments mismatch: current '$CKSUM_ARGS', file recorded with '$args'" 1>&2 + exit 1 + fi + ;; + + FILE) + [ -z "$VERBOSE" ] || echo " - handling file $args" 1>&2 + if [ ! -f "$1/$args" ]; then + echo "Missing file described in the checksum records: $args" 1>&2 + nofile=1 + cksumbad=1 + else + file="$args" + nofile='' + fi + ;; + + CKSUM) + if [ -z "$nofile" ]; then + if [ -z "$file" ]; then + echo "Checksum without filename" 1>&2 + exit 1 + fi + [ -z "$VERBOSE" ] || echo " - about to check $file for $args" 1>&2 + o=`cd "$1" && $CKSUM $CKSUM_ARGS "$file"` + [ -z "$VERBOSE" ] || echo " - got checksum $o" 1>&2 + if [ "$o" != "$args" ]; then + echo "Bad checksum for file $file" 1>&2 + cksumbad=1 + else + if [ -n "$SHADOWDIR" ]; then + d=`dirname "$file"` + mkdir -p "$SHADOWDIR"/t/"$d" + touch "$SHADOWDIR"/t/"$file" + fi + fi + else + [ -z "$VERBOSE" ] || echo " - skipping checksum $args" 1>&2 + fi + ;; + + *) + echo "Unsupported checksum keyword $cmd" 1>&2 + exit 1 + ;; + esac + done < "$cksumfile" + + if [ -n "$cksumbad" ]; then + echo "Some files failed the checksum check" 1>&2 + exit 1 + fi + [ -z "$VERBOSE" ] || echo "- all fine!" 1>&2 +} + +# s5 mksum path +# Calculate the checksums of the stock S5 template files and record +# them into the S5 presentation at path +# +s5_mksum() +{ + [ -z "$VERBOSE" ] || echo "s5_mksum: path $1" 1>&2 + if [ -z "$1" ]; then + echo 'Usage: s5 mksum path' 1>&2 + exit 1 + fi + + if [ -z "$NOOP" ] && ! [ -d "$1/" ]; then + echo "Not a directory: $1" 1>&2 + exit 1 + fi + + cksumfile="$1/s5-checksums.txt" + [ -z "$VERBOSE" ] || echo "- from ${S5_TEMPLATE} to $cksumfile" 1>&2 + (cd "${S5_TEMPLATE}" && \ + echo "CKSUM_CMD $CKSUM" && \ + echo "CKSUM_ARGS $CKSUM_ARGS" && \ + find . -type f | sed -e 's,^\./,,' | while read f; do + s5_mksum_single "$f" + done) | if [ -z "$NOOP" ]; then + cat > "$cksumfile" + if [ -n "$VERBOSE" ]; then + cnt=`egrep -ce '^CKSUM ' "$cksumfile"` + echo "- $cnt checksums recorded into $cksumfile" 1>&2 + fi + else + ${NOOP} "Would write checksums to $cksumfile" + cnt=0 + while read line; do + [ -z "$VERBOSE" ] || ${NOOP} "$line" + if expr "$line" : 'CKSUM ' > /dev/null; then + cnt=`expr "$cnt" + 1` + fi + done + ${NOOP} "Would record checksums for $cnt files" + fi +} + +# Internal routine for calculating the checksum of a single file +s5_mksum_single() +{ + o=`$CKSUM $CKSUM_ARGS "$1"` + echo "FILE $1" + echo "CKSUM $o" +} + +# s5 help +# Display the help message and exit +# +s5_help() +{ + cat << EOF +Usage: s5 [-hNv] [-T template] command [args...] + +The available command-line options are: + -h display this help message and exit + -N no-op mode, just display the commands without executing them + -T template directory, default %%PREFIX%%/share/s5/s5-blank + -v verbose operation, display diagnostic information + +The available commands are: + blank path + Create a new S5 presentation at the specified path + + check path + Alias for cksum + + cksum path + Verify the checksums of the S5 presentation at path + + create path + Alias for blank + + help + Display this help message and exit + + mksum path + Store the template checksums at the specified path + + new path + Alias for blank + + update path + Update an S5 presentation with the new S5 template files + + usage + Alias for help + + verify path + Alias for cksum +EOF +} + +# Internal routine: create a temporary directory for tracking checksum files +s5_shadowdir_create() +{ + d=`mktemp -d -t s5tool` + if [ ! -d "$d" ]; then + echo "Could not create a shadow directory using mktemp" 1>&2 + exit 1 + fi + chmod 700 "$d" + trap s5_shadowdir_cleanup EXIT HUP INT QUIT TERM PIPE + SHADOWDIR="$d" +} + +# Internal routine: clean up the temporary directory at exit time +s5_shadowdir_cleanup() +{ + if [ -n "$SHADOWDIR" ] && [ -d "$SHADOWDIR" ] && [ -w "$SHADOWDIR" ]; then + rm -rf "$SHADOWDIR"/t + rmdir "$SHADOWDIR" + fi +} + +# s5_update path +# Update the S5 presentation at the specified path with files from +# the template directory, but only if the S5 presentation has not +# been modified in the meantime +# +s5_update() +{ + [ -z "$VERBOSE" ] || echo "s5_update: path $1" 1>&2 + s5_shadowdir_create + s5_cksum "$1" + + [ -z "$VERBOSE" ] || echo "s5_update: checking for new files" 1>&2 + (cd "$S5_TEMPLATE" && find . -type f) | ( + noupdate='' + while read f; do + [ -z "$VERBOSE" ] || echo "- $f" 1>&2 + if [ -f "$1/$f" ]; then + [ -z "$VERBOSE" ] || echo " - exists in the working directory" 1>&2 + if cmp -s "$S5_TEMPLATE/$f" "$1/$f"; then + [ -z "$VERBOSE" ] || echo " - the files are the same :)" 1>&2 + else + if [ ! -f "$SHADOWDIR"/t/"$f" ]; then + echo "File in template and working dir, but not part of the previous template: $f" 1>&2 + noupdate=1 + fi + fi + fi + done + if [ -n "$noupdate" ]; then + echo "Not proceeding with the update" 1>&2 + exit 1 + fi + ) + + [ -z "$VERBOSE" ] || echo "s5_update: about to delete files" 1>&2 + (cd "$SHADOWDIR"/t && find . -type f) | while read f; do + if [ ! -f "$S5_TEMPLATE/$f" ]; then + ${NOOP} rm ${VERBOSE:+'-v'} "$1/$f" + fi + done + + [ -z "$VERBOSE" ] || echo "s5_update: about to copy files" 1>&2 + (cd "$S5_TEMPLATE" && find . -mindepth 1 -type d) | while read d; do + if [ ! -d "$1/$d" ]; then + ${NOOP} mkdir -p ${VERBOSE:+'-v'} "$1/$d" + else + [ -z "$VERBOSE" ] || echo "- existing dir $d" 1>&2 + fi + done + (cd "$S5_TEMPLATE" && find . -type f) | while read f; do + ${NOOP} cp -p ${VERBOSE:+'-v'} "$S5_TEMPLATE/$f" "$1/$f" + done + + [ -z "$VERBOSE" ] || echo "s5_update: invoking s5_mksum" 1>&2 + s5_mksum "$1" +} + +# Process the command-line options +while getopts 'hNT:v' o; do + case "$o" in + h) + s5_help + exit 0 + ;; + + N) + NOOP='echo' + ;; + + T) + S5_TEMPLATE="$OPTARG" + ;; + + v) + VERBOSE="${VERBOSE}v" + ;; + + *) + [ "$o" = '?' ] || echo "Unrecognized option '$o'" 1>&2 + s5_help + exit 1 + ;; + esac +done +shift `expr "$OPTIND" - 1` + +# Treat a simple "s5" invocation as a usage request +if [ -z "$1" ]; then + s5_help + exit +fi + +# Okay, we have some a command... +[ -z "$VERBOSE" ] || echo "Parsing a command: $1" 1>&2 +case "$1" in + # b(lank), cr(eate), n(ew) + b|bl|bla|blan|blank|cr|cre|crea|creat|create|n|ne|new) + shift + s5_blank "$1" + ;; + + # ch(eck), ck(sum), v(erify) + ch|che|chec|check|ck|cks|cksu|cksum|v|ve|ver|verify) + shift + s5_cksum "$1" + ;; + + # h(elp), us(age) + h|he|hel|help|us|usa|usag|usage) + shift + s5_help + ;; + + # m(ksum) + m|mk|mks|mksu|mksum) + shift + s5_mksum "$1" + ;; + + # up(date) + up|upd|upda|updat|update) + shift + s5_update "$1" + ;; + + *) + echo "Unrecognized s5 command $1" 1>&2 + s5_help 1>&2 + exit 1 + ;; +esac Property changes on: head/textproc/s5/files/s5.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property