diff --git a/glibc.spec b/glibc.spec index 525173f..4e95224 100644 --- a/glibc.spec +++ b/glibc.spec @@ -111,21 +111,19 @@ # any lua %pre, %post, %postun, etc. sections to have them expand into # those scripts. It only works in lua sections and not anywhere else. %global glibc_post_funcs %{expand: --- We use lua posix.exec because there may be no shell that we can run --- during glibc upgrade. We used to implement much of %%post as a C --- program, but from an overall maintenance perspective the lua in the --- spec file was simpler and safer given the operations required. +-- We use lua because there may be no shell that we can run during +-- glibc upgrade. We used to implement much of %%post as a C program, +-- but from an overall maintenance perspective the lua in the spec +-- file was simpler and safer given the operations required. -- All lua code will be ignored by rpm-ostree; see: -- https://github.com/projectatomic/rpm-ostree/pull/1869 -- If we add new lua actions to the %%post code we should coordinate -- with rpm-ostree and ensure that their glibc install is functional. -function post_exec (program, ...) - local pid = posix.fork () - if pid == 0 then - posix.exec (program, ...) - assert (nil) - elseif pid > 0 then - posix.wait (pid) +-- +-- Note: We use _prefix because Fedora's UsrMove says so. +function call_ldconfig () + if not rpm.execute("%{_prefix}/sbin/ldconfig") then + io.stdout:write ("Error: call to %{_prefix}/sbin/ldconfig failed.\n") end end @@ -133,12 +131,15 @@ function update_gconv_modules_cache () local iconv_dir = "%{_libdir}/gconv" local iconv_cache = iconv_dir .. "/gconv-modules.cache" local iconv_modules = iconv_dir .. "/gconv-modules" - if (posix.utime (iconv_modules) == 0) then - if (posix.utime (iconv_cache) == 0) then - post_exec ("%{_prefix}/sbin/iconvconfig", - "-o", iconv_cache, - "--nostdlib", - iconv_dir) + if posix.utime(iconv_modules) == 0 then + if posix.utime (iconv_cache) == 0 then + if not rpm.execute("%{_prefix}/sbin/iconvconfig", + "-o", iconv_cache, + "--nostdlib", + iconv_dir) + then + io.stdout:write ("Error: call to %{_prefix}/sbin/iconvconfig failed.\n") + end else io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n") end @@ -2047,8 +2048,7 @@ end -- the cache early to avoid any problems running binaries with -- the new glibc. --- Note: We use _prefix because Fedora's UsrMove says so. -post_exec ("%{_prefix}/sbin/ldconfig") +call_ldconfig() -- (4) Update gconv modules cache. -- If the /usr/lib/gconv/gconv-modules.cache exists, then update it @@ -2060,7 +2060,7 @@ update_gconv_modules_cache() -- (5) On upgrades, restart systemd if installed. "systemctl -q" does -- not suppress the error message (which is common in chroots), so --- open-code post_exec with standard error suppressed. +-- open-code rpm.execute with standard error suppressed. if tonumber(arg[2]) >= 2 and posix.access("%{_prefix}/bin/systemctl", "x") then