%pretrans -p <lua>
if not macros then
  fwdir = "/lib/firmware"
else
  fwdir = macros._firmwaredir
end
paths = {"ad103", "ad104", "ad106", "ad107"}
for i = 1, 4 do
  path = fwdir .. "/nvidia/" .. paths[i]
  st = posix.stat(path)
  if st and st.type == "directory" then
    status = os.rename(path, path .. ".rpmmoved")
    if not status then
      suffix = 0
      while not status do
        suffix = suffix + 1
        status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
      end
      os.rename(path, path .. ".rpmmoved")
    end
  end
end
