diff options
| author | nippy <you@example.com> | 2026-04-12 16:43:55 +0200 |
|---|---|---|
| committer | nippy <you@example.com> | 2026-04-12 16:43:55 +0200 |
| commit | 8e94c144b376015cf67750bbf2727204c4bb213b (patch) | |
| tree | 8961ba989c1b4cf9fa3d7174d1e29ec3324b9362 /raveos-calamares/0001-support-yay.patch | |
| parent | e023d81615abfeaaac7a22807f7d722072280ea8 (diff) | |
| download | RaveOS-PKGBUILD-8e94c144b376015cf67750bbf2727204c4bb213b.tar.gz RaveOS-PKGBUILD-8e94c144b376015cf67750bbf2727204c4bb213b.zip | |
update Live
Diffstat (limited to 'raveos-calamares/0001-support-yay.patch')
| -rw-r--r-- | raveos-calamares/0001-support-yay.patch | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/raveos-calamares/0001-support-yay.patch b/raveos-calamares/0001-support-yay.patch new file mode 100644 index 0000000..2f41b31 --- /dev/null +++ b/raveos-calamares/0001-support-yay.patch @@ -0,0 +1,155 @@ +diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py +index e373a3443..05c8d22d3 100644 +--- a/src/modules/packages/main.py ++++ b/src/modules/packages/main.py +@@ -475,6 +475,135 @@ class PMPacman(PackageManager): + + self.run_pacman(command) + ++class PMYay(PackageManager): ++ backend = "yay" ++ ++ def __init__(self): ++ import re ++ import shutil ++ ++ progress_match = re.compile("^\\((\\d+)/(\\d+)\\)") ++ ++ # Note that this writes to /etc/sudoers.d, NOT /etc/sudoers! ++ sudoers_entry = open("/etc/sudoers.d/autoupdate", "w") ++ sudoers_entry.write("nobody ALL = NOPASSWD: " + shutil.which("pacman")) ++ sudoers_entry.close() ++ ++ def line_cb(line): ++ if line.startswith(":: "): ++ self.in_package_changes = "package" in line or "hooks" in line ++ else: ++ if self.in_package_changes and line.endswith("...\n"): ++ # Update the message, untranslated; do not change the ++ # progress percentage, since there may be more "installing..." ++ # lines in the output for the group, than packages listed ++ # explicitly. We don't know how to calculate proper progress. ++ global custom_status_message ++ custom_status_message = "yay: " + line.strip() ++ libcalamares.job.setprogress(self.progress_fraction) ++ libcalamares.utils.debug(line) ++ ++ self.in_package_changes = False ++ self.line_cb = line_cb ++ ++ yay = libcalamares.job.configuration.get("yay", None) ++ if yay is None: ++ yay = dict() ++ if type(yay) is not dict: ++ libcalamares.utils.warning("Job configuration *yay* will be ignored.") ++ yay = dict() ++ self.yay_num_retries = yay.get("num_retries", 0) ++ self.yay_disable_timeout = yay.get("disable_download_timeout", False) ++ self.yay_needed_only = yay.get("needed_only", False) ++ ++ def reset_progress(self): ++ self.in_package_changes = False ++ # These are globals ++ self.progress_fraction = (completed_packages * 1.0 / total_packages) ++ ++ def run_yay(self, command, callback=False): ++ """ ++ Call yay in a loop until it is successful or the number of retries is exceeded ++ :param command: The yay command to run ++ :param callback: An optional boolean that indicates if this yay run should use the callback ++ :return: ++ """ ++ ++ yay_count = 0 ++ while yay_count <= self.yay_num_retries: ++ yay_count += 1 ++ try: ++ if False: # callback: ++ libcalamares.utils.target_env_process_output(command, self.line_cb) ++ else: ++ libcalamares.utils.target_env_process_output(command) ++ ++ return ++ except subprocess.CalledProcessError: ++ if yay_count <= self.yay_num_retries: ++ pass ++ else: ++ raise ++ ++ def install(self, pkgs, from_local=False): ++ import os ++ ++ os.environ["PWD"] = "/var/cache" ++ os.environ["XDG_CACHE_HOME"] = "/var/cache" ++ ++ command = ["sudo", "-E", "-u", "nobody", "yay"] ++ ++ if from_local: ++ command.append("-U") ++ else: ++ command.append("-S") ++ ++ # Don't ask for user intervention, take the default action ++ command.append("--noconfirm") ++ ++ # Don't report download progress for each file ++ command.append("--noprogressbar") ++ ++ if self.yay_needed_only is True: ++ command.append("--needed") ++ ++ if self.yay_disable_timeout is True: ++ command.append("--disable-download-timeout") ++ ++ command += pkgs ++ ++ self.reset_progress() ++ self.run_yay(command, True) ++ ++ def remove(self, pkgs): ++ import os ++ ++ os.environ["PWD"] = "/var/cache" ++ os.environ["XDG_CACHE_HOME"] = "/var/cache" ++ ++ self.reset_progress() ++ self.run_yay(["sudo", "-E", "-u", "nobody", "yay", "-Rs", "--noconfirm"] + pkgs, True) ++ ++ def update_db(self): ++ import os ++ ++ os.environ["PWD"] = "/var/cache" ++ os.environ["XDG_CACHE_HOME"] = "/var/cache" ++ ++ self.run_yay(["sudo", "-E", "-u", "nobody", "yay", "-Sy"]) ++ ++ def update_system(self): ++ import os ++ ++ os.environ["PWD"] = "/var/cache" ++ os.environ["XDG_CACHE_HOME"] = "/var/cache" ++ ++ command = ["sudo", "-E", "-u", "nobody", "yay", "-Su", "--noconfirm"] ++ if self.yay_disable_timeout is True: ++ command.append("--disable-download-timeout") ++ ++ self.run_yay(command) ++ + + class PMPamac(PackageManager): + backend = "pamac" +diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf +index 6e62f4b5f..74ab8d3cb 100644 +--- a/src/modules/packages/packages.conf ++++ b/src/modules/packages/packages.conf +@@ -29,6 +29,7 @@ + # - pacman - Pacman + # - pamac - Manjaro package manager + # - portage - Gentoo package manager ++# - yay - AUR package manager + # - yum - Yum RPM frontend + # - zypp - Zypp RPM frontend + # +-- +2.35.1 + |