add md5 as checksum algorithm for stat module

This commit is contained in:
Tobias Klaus 2019-12-01 01:05:21 +01:00
parent cdc207061b
commit 50764b07fc

View file

@ -36,7 +36,7 @@ function main(arg)
, follow = { default=false, type='bool' }
, get_md5 = { default=true, type='bool'}
, get_checksum = { default=true, type='bool' }
, checksum_algorithm = { default='sha1', type='str', choices={'sha1'}, aliases={'checksum_algo', 'checksum'}}
, checksum_algorithm = { default='sha1', type='str', choices={'sha1', 'md5'}, aliases={'checksum_algo', 'checksum'}}
}
)
@ -111,7 +111,7 @@ function main(arg)
end
if 0 ~= d['isreg'] and get_checksum and 0 == unistd.access(path, "r") then
local chksums = { sha1=File.sha1 }
local chksums = { sha1=File.sha1, md5=File.md5 }
d['checksum'] = chksums[p['checksum_algorithm']](module, path)
end