/ updateRFC.sh
updateRFC.sh
1 #/bin/sh 2 RFCs="5280 5208 3369 3161 2986 4211 4210 8017 4511" 3 downloadRFC() { 4 URL="https://www.ietf.org/rfc/rfc$1.txt" 5 if [ -x /usr/bin/fetch ]; then 6 /usr/bin/fetch -m --no-verify-peer $URL 7 elif [ -x /usr/bin/wget ]; then 8 /usr/bin/wget -N --no-check-certificate $URL 9 elif [ ! -r dumpasn1.cfg ]; then 10 echo Please download $URL in this directory. 11 exit 1 12 fi 13 } 14 echo '{}' > rfcdef.json # start from scratch 15 mkdir -p rfc 16 cd rfc 17 for n in $RFCs; do 18 downloadRFC $n 19 ../parseRFC.js rfc$n.txt ../rfcdef.json 20 done 21 cd .. 22 { 23 echo "// content parsed from ASN.1 definitions as found in the following RFCs: $RFCs" 24 echo "// Copyright (C) The IETF Trust (2008)" 25 echo "// as far as I can tell this file is allowed under the following clause:" 26 echo "// It is acceptable under the current IETF rules (RFC 5378) to modify extracted code if necessary." 27 echo "// https://trustee.ietf.org/about/faq/#reproducing-rfcs" 28 echo -n "export const rfcdef = " 29 cat rfcdef.json 30 echo ";" 31 } > rfcdef.js 32 echo Conversion completed.