#!/bin/bash # PRIORART: collect proofs of prior art to help prepare against patent attacks # copyleft by Hartmut Pilch # Time-stamp: <1999-12-18 12:57:25 phm> set -ax CONF=/var/www/swpat/purci/priorart.conf TARDIR=/var/www/swpat/purci/cnino MIR=/var/www/purci/mirror MIRUSR=phm;MIRGRP=mirror; test -d $TARDIR || mkdir $TARDIR || { echo "cant mkdir $TARDIR";exit 1; } NULLYEAR=1998 n2l () { if test $1 -lt 10;then echo $[10#$1];else echo -e \\$(printf %o $[55+$1]);fi; } kjmt () { set $(date +"%Y %m %d");echo $(n2l $[$1-$NULLYEAR])$(n2l $2)$(n2l $3); } wg () { wget -r -l 1 -k -m -np -R ps,pdf,tar,zip,gz,tgz,Z $@; } urlbody () { expr $1 : ".*://\(.*\)"; } cd_stem_subdirs () { STEM=$1;shift && test $STEM != "#" && if test $1 = extern; then shift; cd $MIR;SUBDIRS=; for P in $@;do wg $P;SUBDIRS="$SUBDIRS $(urlbody $P)"; chown -R $MIRUSR.$MIRGRP .; done; else SUBDIRS=$@; fi; } tarnew () { local TGZ=$1 FL=/tmp/FILELIST_$$; shift && dayswork $@ > $FL && test -s $FL && tar --create --no-recursion --files-from $FL --gzip --verbose --file=$TGZ; rm -f $FL; } KJMT=$(kjmt); tgz () { echo $TARDIR/$1$KJMT.tgz; } dayswork () { find $@ -type f -name '[^#]*[^~]' -mtime -1; } base () { grep "^${1:-\w}" $CONF | while read LINE;do (cd_stem_subdirs $LINE && tar czf $TARDIR/$STEM-$KJMT.tgz $SUBDIRS); done; } last () { grep "^${1:-\w}" $CONF | while read LINE;do (cd_stem_subdirs $LINE && tarnew $TARDIR/$STEM+$KJMT.tgz $SUBDIRS); done; (cd $TARDIR;sh make_index > cnino.html); } usage () { cat <