-- Log package installs, upgrades, downgrades and removals -- By pmatilai@laiskiainen.org -- Licenced under the GPL -- don't log when in --test mode configs = { "RPM::Options", "RPM::Install-Options", "RPM::Erase-Options" } for i, conf in ipairs(configs) do rpmopts = confgetlist(conf, "") for j, opt in ipairs(rpmopts) do if string.find(opt, "test") then return end end end if confexists("Temp::LogList") then logfile = io.open(confget("Dir::State::Logfile"), "a+") for i, str in ipairs(confgetlist("Temp::LogList")) do logfile:write(os.date().." "..str.."\n") end logfile:close() return end function log(pkg, oper) if statremove(pkg) then logstr = "remove, "..pkgname(pkg).."-"..verstr(pkgvercur(pkg)) elseif statnewinstall(pkg) then logstr = "install, "..pkgname(pkg).."-"..verstr(pkgverinst(pkg)) elseif statinstall(pkg) then logstr = "upgrade, "..pkgname(pkg).."-"..verstr(pkgvercur(pkg)).." => "..verstr(pkgverinst(pkg)) elseif statdowngrade(pkg) then logstr = "downgrade, "..pkgname(pkg).."-"..verstr(pkgvercur(pkg)).." => "..verstr(pkgverinst(pkg)) end confset("Temp::LogList::", logstr) end for i, pkg in ipairs(pkglist()) do if not statkeep(pkg) then log(pkg) end end -- vim:ts=4