int pakfire_jail_shell(struct pakfire_jail* jail);
int pakfire_jail_ldconfig(struct pakfire* pakfire);
+int pakfire_jail_run_systemd_tmpfiles(struct pakfire* pakfire);
#endif /* PAKFIRE_PRIVATE */
return pakfire_jail_exec_interactive(jail, argv);
}
-int pakfire_jail_ldconfig(struct pakfire* pakfire) {
+static int pakfire_jail_run_if_possible(struct pakfire* pakfire, const char** argv) {
char path[PATH_MAX];
+ int r;
- const char* ldconfig = "/sbin/ldconfig";
-
- // Check if ldconfig exists before calling it to avoid overhead
- int r = pakfire_path(pakfire, path, "%s", ldconfig);
+ r = pakfire_path(pakfire, path, "%s", *argv);
if (r)
return r;
- // Check if ldconfig is executable
+ // Check if the file is executable
r = access(path, X_OK);
if (r) {
- DEBUG(pakfire, "%s is not executable. Skipping...\n", ldconfig);
+ DEBUG(pakfire, "%s is not executable. Skipping...\n", *argv);
return 0;
}
+ return pakfire_jail_run(pakfire, argv, 0, NULL);
+}
+
+int pakfire_jail_ldconfig(struct pakfire* pakfire) {
const char* argv[] = {
- ldconfig, NULL,
+ "/sbin/ldconfig",
+ NULL,
};
- // Run ldconfig
- return pakfire_jail_run(pakfire, argv, 0, NULL);
+ return pakfire_jail_run_if_possible(pakfire, argv);
+}
+
+int pakfire_jail_run_systemd_tmpfiles(struct pakfire* pakfire) {
+ const char* argv[] = {
+ "/usr/bin/systemd-tmpfiles",
+ "--create",
+ NULL,
+ };
+
+ return pakfire_jail_run_if_possible(pakfire, argv);
}
pakfire_file_set_gname(file, "root");
}
+ if (pakfire_file_matches(file, "/usr/lib/tmpfiles.d/*.conf")) {
+ pakfire_package_add_dep(packager->pkg,
+ PAKFIRE_PKG_REQUIRES, "pakfire(systemd-tmpfiles)");
+
+ // Ask to pre-install systemd
+ pakfire_package_add_dep(packager->pkg,
+ PAKFIRE_PKG_PREREQUIRES, "systemd");
+ }
+
// Append the file to the filelist
return pakfire_filelist_add(packager->filelist, file);
}
{ "Digest-SHA2-512" },
{ "Digest-SHA2-256" },
+ // Systemd
+ { "systemd-tmpfiles" },
+
// The end
{ NULL },
};
return 0;
}
+static int pakfire_transaction_apply_systemd_tmpfiles(
+ struct pakfire_transaction* transaction, struct pakfire_package* pkg) {
+ // Apply any tmpfiles (ignore any errors)
+ if (pakfire_package_matches_dep(pkg, PAKFIRE_PKG_REQUIRES, "pakfire(systemd-tmpfiles)"))
+ pakfire_jail_run_systemd_tmpfiles(transaction->pakfire);
+
+ return 0;
+}
+
static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
struct pakfire_db* db, const enum pakfire_actions action, struct pakfire_package* pkg, struct pakfire_archive* archive) {
if (!pkg) {
if (r)
break;
+ // Apply systemd tmpfiles
+ r = pakfire_transaction_apply_systemd_tmpfiles(transaction, pkg);
+ if (r)
+ break;
+
r = pakfire_transaction_run_script(transaction, db,
"postin", pkg, archive);
break;
if (r)
break;
+ // Apply systemd tmpfiles
+ r = pakfire_transaction_apply_systemd_tmpfiles(transaction, pkg);
+ if (r)
+ break;
+
r = pakfire_transaction_run_script(transaction, db,
"postup", pkg, archive);
break;