curl-library
Re: mk-ca-bundle.lua
Date: Fri, 20 Aug 2010 18:27:33 +0200
Hi Jeff,
Am 20.08.2010 14:18, schrieb Jeff Pohlmeyer:
> For those who don't have VB or Perl, here's one in Lua.
>
> Interesting to note, a Lua installation is actually smaller than
> "certdata.txt" :-)
woah -- terrible fast! I first thought it didnt even work but found the
ca-bundle.crt created fine ...
Therefore I added a final output:
--- mk-ca-bundle.lua.orig Fri Aug 20 16:02:25 2010
+++ mk-ca-bundle.lua Fri Aug 20 18:05:17 2010
@@ -133,7 +133,7 @@
-- Lua has no built-in network client, so try curl first, then wget.
if do_download then
io.stderr:write("Attempting download with curl, please wait...\n")
- local curl_rv=os.execute(".curl --fail -Ss "..url..' -o '..certdata_txt)
+ local curl_rv=os.execute("curl --fail -Ss "..url..' -o '..certdata_txt)
if curl_rv~=0 then
io.stderr:write("Download with curl failed, error #",curl_rv,"\n");
io.stderr:write("Attempting download with wget, please wait...\n")
@@ -247,6 +247,7 @@
local in_license_block = false
local caname = nil
local data = nil
+local numcerts = 0
for line in infile:lines() do
if line:find('***** BEGIN LICENSE BLOCK *****',1,true) then
@@ -271,6 +272,7 @@
outfile:write(data, data:find("\n$") and "" or "\n")
outfile:write('-----END CERTIFICATE-----\n')
data=nil
+ numcerts=numcerts+1
else
data=data..line:gsub('\\([0-7][0-7][0-7])',
function(a) return string.char(tonumber(a,8)) end )
@@ -291,4 +293,7 @@
if delete_certdata then
os.remove(certdata_txt)
end
+
+io.write("Done (",numcerts," CA certs processed).\n")
+
oh, and I removed the leading dot with the curl comamnd so that it can
be found through seach path; or did you have a special reason why you
only wanted to loo into current dir?
(BTW. this was my 1st attempt to modify a lua script, so please correct
me if I done it wrong)
Gün.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-20