From 876ee756cdefce80e0fd3a6035558b7b24c50079 Mon Sep 17 00:00:00 2001 From: sulincix Date: Sun, 17 Nov 2024 11:12:01 +0000 Subject: [PATCH] run sysconf as parallel --- src/operations/utility/sysconf.vala | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/operations/utility/sysconf.vala b/src/operations/utility/sysconf.vala index 89777bf..6f714a3 100755 --- a/src/operations/utility/sysconf.vala +++ b/src/operations/utility/sysconf.vala @@ -14,22 +14,29 @@ private static int sysconf_main (string[] args) { }else { run ("ldconfig"); } + jobs j = new jobs(); foreach (string hook in find (get_configdir () + "/sysconf.d")) { - if (isfile (hook)) { - info (_ ("Run hook: %s").printf (sbasename (hook))); - create_dir (get_storage () + "/sysconf/" + sbasename (hook)); - if (DESTDIR != "/") { - hook=hook[DESTDIR.length:]; - if (0 != run_args ( {"chroot", get_destdir (), hook})) { - warning (_ ("Failed to run sysconf: %s").printf (sbasename (hook))); - } - }else if (0 != run_args ({hook})) { + j.add((void*)run_sysconf, hook); + } + j.run(); + restore_env(); + return 0; +} + +private static void run_sysconf(string fhook){ + string hook = fhook; + if (isfile (hook)) { + info (_ ("Run hook: %s").printf (sbasename (hook))); + create_dir (get_storage () + "/sysconf/" + sbasename (hook)); + if (DESTDIR != "/") { + hook=hook[DESTDIR.length:]; + if (0 != run_args ( {"chroot", get_destdir (), hook})) { warning (_ ("Failed to run sysconf: %s").printf (sbasename (hook))); } + }else if (0 != run_args ({hook})) { + warning (_ ("Failed to run sysconf: %s").printf (sbasename (hook))); } } - restore_env(); - return 0; } static void sysconf_init () {