mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
grabrfc: update fetching
The canonical server for fetching draft RFCs is defunct for ftp access, so a mirror site is now used. Add -d flag to fetch draft RFCs but otherwise do not. When fetching drafts, also fetch index and abstract files. For both normal and draft RFCs, only look for .txt files as there a lot of other files in remote directories that are not relevant.
This commit is contained in:
parent
7213f4a34d
commit
4607b18740
1 changed files with 43 additions and 12 deletions
|
@ -1,19 +1,27 @@
|
||||||
#!/bin/rc
|
#!/bin/rc -b
|
||||||
# grabrfc - copy new rfcs and drafts into /lib/rfc
|
# grabrfc - copy new rfcs into /lib/rfc
|
||||||
|
# grabrfc -d - copy draft rfcs as well
|
||||||
rfork en
|
rfork en
|
||||||
path=(/bin)
|
path=(/bin)
|
||||||
fn cd
|
fn cd
|
||||||
|
|
||||||
|
flagfmt='d:drafts'
|
||||||
|
eval `''{aux/getflags $*} || exec aux/usage
|
||||||
|
|
||||||
dom=`{ndb/query sys $sysname dom}
|
dom=`{ndb/query sys $sysname dom}
|
||||||
if(~ $dom '') dom=$sysname
|
if(~ $dom '') dom=$sysname
|
||||||
|
|
||||||
ramfs
|
ftpfs -q/ -a $user@$dom ftp.rfc-editor.org
|
||||||
ftpfs -q/ -a $user@$dom ftp.rfc-editor.org # was ftp.isi.edu
|
|
||||||
|
|
||||||
found=no
|
found=no
|
||||||
LIB=/lib/rfc
|
LIB=/lib/rfc
|
||||||
cd /n/ftp/in-notes
|
cd /n/ftp/in-notes
|
||||||
for(i in rfc*){
|
fn cprfc {
|
||||||
|
f=$1
|
||||||
|
shift
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i in rfc*.txt){
|
||||||
target=`{
|
target=`{
|
||||||
echo $i | sed '
|
echo $i | sed '
|
||||||
s/.txt$//
|
s/.txt$//
|
||||||
|
@ -31,19 +39,42 @@ if (~ $found yes)
|
||||||
sed 's/^[0-9]/rfc&/' >$LIB/index
|
sed 's/^[0-9]/rfc&/' >$LIB/index
|
||||||
unmount /n/ftp
|
unmount /n/ftp
|
||||||
|
|
||||||
ftpfs -q/ -a $user@$dom ftp.ietf.org
|
if (~ $drafts '')
|
||||||
|
exit
|
||||||
|
|
||||||
|
ftpfs -q/ -a $user@$dom ftp.math.utah.edu
|
||||||
|
|
||||||
# copy in new ones
|
# copy in new ones
|
||||||
found=no
|
found=no
|
||||||
LIB=/lib/rfc/drafts
|
LIB=/lib/rfc/drafts
|
||||||
mkdir -p $LIB
|
mkdir -p $LIB
|
||||||
cd /n/ftp/internet-drafts
|
cd /n/ftp/pub/mirrors/ftp.ietf.org/internet-drafts
|
||||||
for(i in *){
|
for(i in draft-*.txt){
|
||||||
target=$i
|
target=`{
|
||||||
|
echo $i | sed '
|
||||||
|
s/.txt$//
|
||||||
|
s/draft-//'
|
||||||
|
}
|
||||||
if (test ! -e $LIB/$target && test -f $i &&
|
if (test ! -e $LIB/$target && test -f $i &&
|
||||||
test `{ls -s $i | sed 's/ .*//'} -ge 2){
|
test `{ls -s $i | sed 's/ .*//'} -ge 2){
|
||||||
cp $i $LIB/$target
|
cp $i $LIB/$target
|
||||||
chmod 664 $LIB/$target
|
chmod 664 $LIB/$target
|
||||||
echo drafts/$i
|
found=yes
|
||||||
|
echo drafts/$target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (~ $found yes) {
|
||||||
|
if (test -f 1id-index.txt)
|
||||||
|
<1id-index.txt sed '
|
||||||
|
s/\.txt//
|
||||||
|
s/draft-//' > $LIB/index
|
||||||
|
if not
|
||||||
|
>[1=2] echo no draft index found
|
||||||
|
if (test -f 1id-abstracts.txt)
|
||||||
|
<1id-abstracts.txt sed '
|
||||||
|
s/\.txt//
|
||||||
|
s/draft-//' > $LIB/abstracts
|
||||||
|
if not
|
||||||
|
>[1=2] echo no abstracts found
|
||||||
|
}
|
||||||
|
unmount /n/ftp
|
||||||
|
|
Loading…
Reference in a new issue