mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 04:52:03 -08:00
patch mozboot to work with ostree
This commit is contained in:
parent
51d3c53ed1
commit
97d2a377e7
1 changed files with 100 additions and 0 deletions
100
patches/ostree-mozboot.patch
Normal file
100
patches/ostree-mozboot.patch
Normal file
|
|
@ -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"]
|
||||
Loading…
Add table
Reference in a new issue