diff --git a/patches/ostree-mozboot.patch b/patches/ostree-mozboot.patch new file mode 100644 index 0000000..8ffdad1 --- /dev/null +++ b/patches/ostree-mozboot.patch @@ -0,0 +1,100 @@ +diff --git a/python/mozboot/mozboot/centosfedora.py b/python/mozboot/mozboot/centosfedora.py +index 37aa0e8eaa..7e7cf84481 100644 +--- a/python/mozboot/mozboot/centosfedora.py ++++ b/python/mozboot/mozboot/centosfedora.py +@@ -21,9 +21,8 @@ class CentOSFedoraBootstrapper(LinuxBootstrapper, BaseBootstrapper): + def install_packages(self, packages): + if self.version >= 33 and "perl" in packages: + packages.append("perl-FindBin") +- # watchman is not available on centos/rocky +- if self.distro in ("centos", "rocky", "oracle"): +- packages = [p for p in packages if p != "watchman"] ++ # watchman is not available on centos/rocky/f42 ++ packages = [p for p in packages if p != "watchman"] + self.dnf_install(*packages) + + def upgrade_mercurial(self, current): +@@ -33,7 +32,41 @@ class CentOSFedoraBootstrapper(LinuxBootstrapper, BaseBootstrapper): + self.dnf_update("mercurial") + + def dnf_install(self, *packages): +- if which("dnf"): ++ if which("rpm-ostree"): ++ ++ def not_installed(package): ++ is_installed = subprocess.run( ++ ["rpm", "-q", package], ++ stdout=subprocess.DEVNULL, ++ stderr=subprocess.DEVNULL, ++ ) ++ return is_installed.returncode !=0 ++ ++ packages = list(filter(not_installed, packages)) ++ if len(packages) == 0: ++ return ++ ++ command = ["rpm-ostree", "install"] ++ command.extend(packages) ++ subprocess.run(command, check=True) ++ ++ reboot_confirmation = ( ++ input( ++ "Packages installed successfully. " ++ "A system reboot is required. " ++ "Do you want to reboot now? (y/n): " ++ ).strip().lower() ++ ) ++ ++ if reboot_confirmation == 'y': ++ print("Rebooting...") ++ subprocess.run(["systemctl", "reboot"]) ++ else: ++ raise Exception( ++ f'Reboot deferred. Please reboot to continue mozboot.' ++ ) ++ ++ elif which("dnf"): + + def not_installed(package): + # We could check for "Error: No matching Packages to list", but +@@ -68,7 +101,39 @@ class CentOSFedoraBootstrapper(LinuxBootstrapper, BaseBootstrapper): + self.run_as_root(command) + + def dnf_update(self, *packages): +- if which("dnf"): ++ if which("rpm-ostree"): ++ command = ["rpm-ostree", "upgrade"] ++ ++ result = subprocess.run( ++ command, ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ text=True, ++ check=True ++ ) ++ ++ output = result.stdout + result.stderr ++ ++ if "No upgrade available" in output: ++ return ++ else: ++ reboot_confirmation = ( ++ input( ++ "System upgraded successfully. " ++ "A system reboot is required to continue. " ++ "Do you want to reboot now? (y/n): " ++ ).strip().lower() ++ ) ++ ++ if reboot_confirmation == 'y': ++ print("Rebooting...") ++ subprocess.run(["systemctl", "reboot"]) ++ else: ++ raise Exception( ++ f'Reboot deferred. Please reboot to continue mozboot.' ++ ) ++ ++ elif which("dnf"): + command = ["dnf", "update"] + else: + command = ["yum", "update"]