Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 7ebd2d54a52edc3b3c7abff3f9c8c2a8 > files > 81

apt-0.5.15lorg3.95-0.git522.1.fc14.x86_64.rpm


-- don't bother if no write access to rpmdb
if not posix.access("/var/lib/rpm", "w") then
	return
end

if confget("RPM::GPG-Import", "true") == "false" then
	return
end


keypath = confget("Dir::Etc/f").."gpg/"
keys = posix.dir(keypath)

if not keys then
	return
end

first = 1
for i, key in ipairs(keys) do
	if string.sub(key, 1, 10) == "gpg-pubkey" then
		ret = os.execute("LANG=C rpm -q `basename "..key.."` > /dev/null 2>&1")
		if ret > 0 then
			if first then
				print(_("You don't seem to have one or more of the needed GPG keys in your RPM database."))
				print(_("Importing them now..."))
				first = nil
			end
			ret = os.execute("LANG=C rpm --import "..keypath..key.." > /dev/null 2>&1")
			if ret > 0 then
				print(_("Error importing GPG keys"))
				return
			end
		end
	end
end

-- vim:ts=4