@@ -11,7 +11,6 @@ local lfs = require("lfs")
1111local m = {}
1212m .mirror = os.getenv (" MIRROR" ) or " https://cz.alpinelinux.org/alpine"
1313
14-
1514function m .fatal (...)
1615 m .errormsg (... )
1716 os.exit (1 )
@@ -60,12 +59,12 @@ function m.mkdockerfile(dir, rootfsfile)
6059 if not f then
6160 m .fatal (" Error: %s: %s" , filename , err )
6261 end
63- f :write (string.format (" FROM scratch\n ADD %s /\n CMD [\ " /bin/sh\ " ]\n " , rootfsfile ))
62+ f :write (string.format (' FROM scratch\n ADD %s /\n CMD ["/bin/sh"]\n ' , rootfsfile ))
6463 f :close ()
6564end
6665
6766function m .minirootfs_image (images )
68- for _ ,img in pairs (images ) do
67+ for _ , img in pairs (images ) do
6968 if img .flavor == " alpine-minirootfs" then
7069 return img
7170 end
7675function m .get_minirootfs (images , destdir )
7776 local img = m .minirootfs_image (images )
7877 if destdir then
79- local url = string.format (" %s/%s/releases/%s/%s" ,
80- m .mirror , img .branch , img .arch , img .file )
78+ local url = string.format (" %s/%s/releases/%s/%s" , m .mirror , img .branch , img .arch , img .file )
8179 local archdir = string.format (" %s/%s" , destdir , img .arch )
8280 local ok , errmsg = lfs .mkdir (archdir )
8381 m .fetch_file (url , string.format (" %s/%s" , archdir , img .file ))
8482 m .mkdockerfile (archdir , img .file )
8583 print (img .file )
8684 end
87- return { version = img .version , file = img .file , sha512 = img .sha512 }
85+ return { version = img .version , file = img .file , sha512 = img .sha512 }
8886end
8987
9088-- get array of minirootsfs releases --
9189function m .get_releases (branch , destdir )
92- local arches = { " aarch64" , " armhf" , " armv7" , " ppc64le" , " riscv64" , " s390x" , " x86" , " x86_64" }
90+ local arches = { " aarch64" , " armhf" , " armv7" , " ppc64le" , " riscv64" , " s390x" , " x86" , " x86_64" }
9391 local t = {}
9492 local loop = cqueues .new ()
9593 for _ , arch in pairs (arches ) do
9694 loop :wrap (function ()
97- local url = string.format (" %s/%s/releases/%s/latest-releases.yaml" ,
98- m .mirror , branch , arch )
95+ local url = string.format (" %s/%s/releases/%s/latest-releases.yaml" , m .mirror , branch , arch )
9996 local status , body = m .fetch (url )
10097 if status == " 200" then
10198 t [arch ] = m .get_minirootfs ((yaml .load (body )), destdir )
@@ -142,15 +139,14 @@ if not m.equal_versions(releases) then
142139end
143140
144141local f = io.open (string.format (" %s/checksums.sha512" , destdir ), " w" )
145- for arch ,rel in pairs (releases ) do
142+ for arch , rel in pairs (releases ) do
146143 local line = string.format (" %s %s/%s\n " , rel .sha512 , arch , rel .file )
147144 f :write (line )
148- version = rel .version
145+ version = rel .version
149146end
150147f :close ()
151148
152149-- write version
153150f = io.open (string.format (" %s/VERSION" , destdir ), " w" )
154151f :write (version )
155152f :close ()
156-
0 commit comments