if /etc/ssl/certs does not exist yet stat() returns nil:
error: lua script failed: [string "%pretrans(ca-certificates-
20211016-2.noarch)"]:2: attempt to index a nil value (local 'mode')
Name: ca-certificates
%define ver_date 20211016
Version: %{ver_date}
-Release: 2
+Release: 3
License: GPL v2 (scripts), MPL v2 (mozilla certs), distributable (other certs)
Group: Base
Source0: http://ftp.debian.org/debian/pool/main/c/ca-certificates/%{name}_%{version}.tar.xz
%pretrans -p <lua>
local mode = posix.stat("/etc/ssl/certs")
-if mode["type"] == "link" then
+if mode and mode["type"] == "link" then
posix.unlink("/etc/ssl/certs")
end