public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/fedora-release] f45: Properly handle systemd presets in Lua scripts
@ 2026-08-10  9:34 Dennis Gilmore
  0 siblings, 0 replies; only message in thread
From: Dennis Gilmore @ 2026-08-10  9:34 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/fedora-release
            Branch : f45
            Commit : 60501f2447c0d59d9b30bd263a3e30705f1831e1
            Author : Dennis Gilmore <dennis@ausil.us>
            Date   : 2016-03-15T11:43:20-05:00
            Stats  : +26/-23 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/fedora-release/c/60501f2447c0d59d9b30bd263a3e30705f1831e1?branch=f45

            Log:
            Properly handle systemd presets in Lua scripts

- enable opal-prd.service
- Remove call to grub2-mkconfig

Signed-off-by: Dennis Gilmore <dennis@ausil.us>

---
diff --git a/convert-to-edition.lua b/convert-to-edition.lua
index f10c3cc..d52a471 100644
--- a/convert-to-edition.lua
+++ b/convert-to-edition.lua
@@ -7,7 +7,7 @@ local VARIANT_FILE = "/usr/lib/variant"
 -- Read in /usr/lib/variant and determine the edition
 local function read_variant()
   local variant
-  local f = io.open("/usr/lib/variant", "r")
+  local f = io.open(VARIANT_FILE, "r")
   if f ~= nil then
     while true do
       local line = f:read()
@@ -19,6 +19,7 @@ local function read_variant()
         variant = m
       end
     end
+    f:close()
   end
   return variant
 end
@@ -85,8 +86,8 @@ local function read_presets(path)
       if cmd == "enable" or cmd == "disable" then
         result[#result + 1] = arg
       end
-      f:close()
     end
+    f:close()
   end
   return result
 end
@@ -115,20 +116,23 @@ local variants = {
 }
 
 -- Call out to systemctl to enable or disable presets
-local function set_presets(edition)
+local function set_presets(edition, apply_presets)
   if variants[edition].presets then
     local target = "/usr/lib/systemd/system-preset/80-" .. edition .. ".preset"
-    symlink("../../os.edition.d/presets/80-" .. edition .. ".preset", target)
-    local presets = read_presets(target)
-	local systemctl = "/usr/bin/systemctl"
-	if posix.access(systemctl, "x") then
-      os.execute(systemctl, "preset", "-q",
-                 table.unpack(presets))
-	end
+    symlink("../../os.release.d/presets/80-" .. edition .. ".preset", target)
+
+    if apply_presets then
+      local presets = read_presets(target)
+      local systemctl = "/usr/bin/systemctl"
+      if posix.access(systemctl, "x") then
+        os.execute(systemctl, "preset", "-q",
+                   table.unpack(presets))
+      end
+    end
   end
 end
 
-local function convert_to_edition(edition, do_presets)
+local function convert_to_edition(edition, apply_presets)
   local variant = variants[edition]
   if variant == nil then
     error("undefined edition: " .. edition)
@@ -137,14 +141,7 @@ local function convert_to_edition(edition, do_presets)
   set_issue(variant.issue)
   clear_presets()
 
-  if do_presets then
-    set_presets(edition)
-  end
-
-  local grub = "/usr/sbin/grub2-mkconfig"
-  if posix.access(grub, "x") then
-    execute(grub, "-o", "/boot/grub2/grub.cfg")
-  end
+  set_presets(edition, apply_presets)
 end
 
 local function install_edition(edition)
@@ -160,7 +157,7 @@ local function install_edition(edition)
     -- added
     -- On upgrades, do not enable or disable presets to avoid
     -- surprising the user
-    local initial_install = arg[2] == "1"
+    local initial_install = arg[2] == 1
     convert_to_edition(edition, initial_install)
   end
 end
@@ -171,8 +168,9 @@ local function uninstall_edition(edition)
   -- in %%preun so that we don't have any time where the os-release
   -- symlink is dangling (since in %%postun, the os-release-$EDITION
   -- file will have already been removed)
-  if arg[2] == "0" then
+  if arg[2] == 0 then
     if read_variant() == edition then
+      set_variant("nonproduct")
       convert_to_edition("nonproduct", false)
     end
   end

diff --git a/fedora-release.spec b/fedora-release.spec
index f31ee77..355588c 100644
--- a/fedora-release.spec
+++ b/fedora-release.spec
@@ -5,7 +5,7 @@
 Summary:        Fedora release files
 Name:           fedora-release
 Version:        25
-Release:        0.5
+Release:        0.6
 License:        MIT
 Group:          System Environment/Base
 URL:            http://fedoraproject.org
@@ -334,6 +334,11 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
 %config %attr(0644,root,root) /usr/lib/os.release.d/presets/80-workstation.preset
 
 %changelog
+* Tue Mar 15 2016 Dennis Gilmore <dennis@ausil.us> - 25-0.6
+- Properly handle systemd presets in Lua scripts
+- enable opal-prd.service
+- Remove call to grub2-mkconfig
+
 * Tue Mar 08 2016 Stephen Gallagher <sgallagh@redhat.com> - 25-0.5
 - Add a subpackage for Atomic Host to provide /usr/lib/os-release differences
 

diff --git a/sources b/sources
index 0d14d79..32416a9 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-656b5c75064dc042f2c349b332c9c770  fedora-release-25.tar.bz2
+8370d436c9a73c29ab20ccb8f8666057  fedora-release-25.tar.bz2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10  9:34 [rpms/fedora-release] f45: Properly handle systemd presets in Lua scripts Dennis Gilmore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox