Skip to content

Commit

Permalink
run sysconf as parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Nov 17, 2024
1 parent 6db1c82 commit 876ee75
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/operations/utility/sysconf.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 876ee75

Please sign in to comment.