summaryrefslogtreecommitdiffstats
path: root/_scripts/generate_releases.lua
blob: e01e3fa22b9b07df993283bb0dcc1470c66ffd95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/lua

lyaml = require("lyaml")

url_prefix="https://fr.alpinelinux.org/alpine"
t = { flavors={} }

flavor_def = {
	["alpine"] = {
		title = "Standard",
		desc = "Alpine as it was intended, just enough to get you started."
			.." Network connection recommended." },
	["alpine-extended"] = {
		title = "Extended",
		desc = "Alpine with most common used packages included. Suitable for"
			.." routers and servers that run from RAM." },
	["alpine-vanilla"] = {
		title = "Vanilla",
		desc = "Alpine with a vanilla kernel. This is"
			.." for troubleshooting kernel issues." },
	["alpine-virt"] = {
		title = "Virtual",
		desc = "Same as Standard, with a kernel optimized for virtual machines." },
	["alpine-xen"] = {
		title = "Xen",
		desc = "Xen Dom0 and Xen packages. Your hypervisor of choice." },
	["alpine-rpi"] = {
		title = "Raspberry Pi",
		desc = "Alpine for any Raspberry Pi model." },
	["alpine-uboot"] = {
		title = "Generic ARM",
		desc = "General build for ARM architectures." },
}

for i = 1,#arg do
	local f = assert(io.open(arg[i]))

	for _,v in pairs(lyaml.load(f:read("*a"))) do
		local y,m,d = v.date:match("(%d+)-(%d+)-(%d+)")
		v.datestr = os.date("%b %d, %Y", os.time{year=y, month=m, day=d})
		v.iso_url = ("%s/%s/releases/%s/%s"):format(url_prefix,
			v.branch, v.arch, v.iso)
		v.sha256_url = ("%s.sha256"):format(v.iso_url)
		v.sha1_url = ("%s.sha1"):format(v.iso_url)
		v.asc_url = ("%s.asc"):format(v.iso_url)
		v.sig_url = ("%s.sig"):format(v.iso_url)
		v.size_mb=math.floor(v.size/(1024*1024))


		local flavor = t[v.flavor]
		if flavor == nil then
			local def = flavor_def[v.flavor] or {title="", desc=""}
			flavor = {
				archs = {},
				flavor_title = def.title,
				flavor_desc = def.desc,
			}
			table.insert(t.flavors, flavor)
		end
		flavor[v.arch] = v
		table.insert(flavor.archs, v)
		t[v.flavor] = flavor
	end
end

-- default release
t.default = t.alpine.x86_64

io.write(lyaml.dump{t})