aboutsummaryrefslogtreecommitdiffstats
path: root/misc/shared-mime-info/files/shared-mime-info.ucl.in
blob: 2049db0caa5e997f66ccabd739a4ee1903d8fa78 (plain) (blame)
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
path: "%%PREFIX%%/share/mime/packages"
cleanup: {
	type: lua
	script: <<EOS
local mimedir = "%%PREFIX%%/share/mime/"
local files = { "XMLnamespaces", "aliases", "generic-icons", "globs", "globs2", "icons", "mime.cache", "subclasses", "treemagic", "types", "version"}
for _,filename in ipairs(files) do
	local fpath = mimedir .. filename
	local st = pkg.stat(fpath)
	if st then
		os.remove(fpath)
	end
end
local res = pkg.readdir(mimedir)
if res == nil then goto cleanmime end

for _,dir in ipairs(res) do
	if  dir == "packages" then goto continue end

	local directory = mimedir .. "/" .. dir
	local r = pkg.readdir(directory)
	if r == nil then goto cleandir end
	for _,file in ipairs(r) do
		os.remove(directory .. "/" .. file)
	end
	::cleandir::
	os.remove(directory)

	::continue::
end
::cleanmime::
os.remove(mimedir)
EOS
}
trigger: {
	type: lua
	sandbox: false
	script: <<EOS
print("Building the Shared MIME-Info database cache")
pkg.exec({"%%PREFIX%%/bin/update-mime-database", "%%PREFIX%%/share/mime"})
EOS
}