#!/bin/bash # PRIORART: collect proofs of prior art to prepare against patent attacks # copyleft (GPL) by Hartmut Pilch # Time-stamp: <1999-12-18 12:57:25 phm> #set -ax CONF=/var/www/swpat/purci/priorart.conf FTP=/var/ftp/pub/priorart MIR=/var/www/mirror MIRUSR=phm;MIRGRP=mirror; test -d $FTP || mkdir $FTP || { echo "cant mkdir $FTP";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;shift; set -- $(dayswork $@); test $1 && echo $@ | tar --create --no-recursion --files-from - --gzip --verbose --file=$TGZ; } KJMT=$(kjmt); tgz () { echo $FTP/$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 $FTP/$STEM-$KJMT.tgz $SUBDIRS); done; } last () { grep "^${1:-\w}" $CONF | while read LINE;do (cd_stem_subdirs $LINE && tarnew $FTP/$STEM+$KJMT.tgz $SUBDIRS); done; } usage () { cat <