pakfire_filelist* filelist;
// Scriptlets
- struct pakfire_scriptlet* scriptlets[MAX_SCRIPTLETS];
+ pakfire_scriptlet* scriptlets[MAX_SCRIPTLETS];
unsigned int num_scriptlets;
// Hashes
static int pakfire_archive_parse_scriptlet(pakfire_archive* archive,
const char* path, const char* data, const size_t length) {
- struct pakfire_scriptlet* scriptlet = NULL;
+ pakfire_scriptlet* scriptlet = NULL;
const char* type = NULL;
int r;
return r;
}
-struct pakfire_scriptlet* pakfire_archive_get_scriptlet(
+pakfire_scriptlet* pakfire_archive_get_scriptlet(
pakfire_archive* archive, const char* type) {
- struct pakfire_scriptlet* scriptlet = NULL;
+ pakfire_scriptlet* scriptlet = NULL;
for (unsigned int i = 0; i < archive->num_scriptlets; i++) {
scriptlet = archive->scriptlets[i];
int pakfire_archive_copy(pakfire_archive* archive, const char* path);
int pakfire_archive_link_or_copy(pakfire_archive* archive, const char* path);
-struct pakfire_scriptlet* pakfire_archive_get_scriptlet(
+pakfire_scriptlet* pakfire_archive_get_scriptlet(
pakfire_archive* archive, const char* type);
int pakfire_archive_apply_systemd_sysusers(pakfire_archive* archive);
}
static int pakfire_build_add_scriptlet_requires(pakfire_build* build,
- pakfire_package* pkg, struct pakfire_scriptlet* scriptlet) {
+ pakfire_package* pkg, pakfire_scriptlet* scriptlet) {
struct pakfire_input_buffer buffer = {};
int r;
static int pakfire_build_package_add_scriptlet(pakfire_build* build,
pakfire_package* pkg, pakfire_packager* packager,
const char* type, const char* data) {
- struct pakfire_scriptlet* scriptlet = NULL;
+ pakfire_scriptlet* scriptlet = NULL;
char* shell = NULL;
int r;
for (const char** type = pakfire_scriptlet_types; *type; type++) {
// Fetch the scriptlet
- struct pakfire_scriptlet* scriptlet = pakfire_archive_get_scriptlet(archive, *type);
+ pakfire_scriptlet* scriptlet = pakfire_archive_get_scriptlet(archive, *type);
if (!scriptlet)
continue;
return r;
}
-struct pakfire_scriptlet* pakfire_db_get_scriptlet(pakfire_db* db,
+pakfire_scriptlet* pakfire_db_get_scriptlet(pakfire_db* db,
pakfire_package* pkg, const char* type) {
- struct pakfire_scriptlet* scriptlet = NULL;
+ pakfire_scriptlet* scriptlet = NULL;
sqlite3_stmt* stmt = NULL;
int r = 1;
int pakfire_db_load(pakfire_db* db, pakfire_repo* repo);
-struct pakfire_scriptlet* pakfire_db_get_scriptlet(
+pakfire_scriptlet* pakfire_db_get_scriptlet(
pakfire_db* db, pakfire_package* pkg, const char* type);
int pakfire_db_filelist(pakfire_db* db, pakfire_filelist** filelist);
pakfire_filelist* filelist;
// Scriptlets
- struct pakfire_scriptlet** scriptlets;
+ pakfire_scriptlet** scriptlets;
unsigned int num_scriptlets;
// Digests
}
static int pakfire_packager_write_scriptlet(pakfire_packager* packager,
- pakfire_archive_writer* writer, struct pakfire_scriptlet* scriptlet) {
+ pakfire_archive_writer* writer, pakfire_scriptlet* scriptlet) {
char filename[PATH_MAX];
size_t size;
int r;
}
int pakfire_packager_add_scriptlet(pakfire_packager* packager,
- struct pakfire_scriptlet* scriptlet) {
+ pakfire_scriptlet* scriptlet) {
if (!scriptlet)
return -EINVAL;
const char* sourcepath, const char* path);
int pakfire_packager_add_scriptlet(pakfire_packager* packager,
- struct pakfire_scriptlet* scriptlet);
+ pakfire_scriptlet* scriptlet);
int pakfire_packager_cleanup(pakfire_packager* packager);
return 0;
}
-static int pakfire_scriptlet_set(struct pakfire_scriptlet* scriptlet, const char* data, size_t size) {
+static int pakfire_scriptlet_set(pakfire_scriptlet* scriptlet, const char* data, size_t size) {
if (scriptlet->data)
free(scriptlet->data);
return 0;
}
-static void pakfire_scriptlet_free(struct pakfire_scriptlet* scriptlet) {
+static void pakfire_scriptlet_free(pakfire_scriptlet* scriptlet) {
if (scriptlet->data)
free(scriptlet->data);
if (scriptlet->ctx)
free(scriptlet);
}
-int pakfire_scriptlet_create(struct pakfire_scriptlet** scriptlet,
+int pakfire_scriptlet_create(pakfire_scriptlet** scriptlet,
pakfire_ctx* ctx, const char* type, const char* data, size_t size) {
int r;
return -ENOTSUP;
// Allocate some memory
- struct pakfire_scriptlet* s = calloc(1, sizeof(*s));
+ pakfire_scriptlet* s = calloc(1, sizeof(*s));
if (!s)
return -errno;
return r;
};
-struct pakfire_scriptlet* pakfire_scriptlet_ref(struct pakfire_scriptlet* scriptlet) {
+pakfire_scriptlet* pakfire_scriptlet_ref(pakfire_scriptlet* scriptlet) {
scriptlet->nrefs++;
return scriptlet;
}
-struct pakfire_scriptlet* pakfire_scriptlet_unref(struct pakfire_scriptlet* scriptlet) {
+pakfire_scriptlet* pakfire_scriptlet_unref(pakfire_scriptlet* scriptlet) {
if (--scriptlet->nrefs > 0)
return scriptlet;
return NULL;
}
-const char* pakfire_scriptlet_get_type(struct pakfire_scriptlet* scriptlet) {
+const char* pakfire_scriptlet_get_type(pakfire_scriptlet* scriptlet) {
return scriptlet->type;
}
-const char* pakfire_scriptlet_get_data(struct pakfire_scriptlet* scriptlet, size_t* size) {
+const char* pakfire_scriptlet_get_data(pakfire_scriptlet* scriptlet, size_t* size) {
if (size)
*size = scriptlet->size;
return scriptlet->data;
}
-static int pakfire_scriptlet_is_shell_script(struct pakfire_scriptlet* scriptlet) {
+static int pakfire_scriptlet_is_shell_script(pakfire_scriptlet* scriptlet) {
const char* interpreter = "#!/bin/sh";
// data must be long enough
return 0;
}
-int pakfire_scriptlet_execute(struct pakfire_scriptlet* scriptlet, struct pakfire* pakfire) {
+int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, struct pakfire* pakfire) {
// Detect what kind of script this is and run it
if (pakfire_scriptlet_is_shell_script(scriptlet))
return pakfire_jail_run_script(pakfire, scriptlet->data, scriptlet->size, NULL, NULL, 0);
extern const char* pakfire_scriptlet_types[13];
-struct pakfire_scriptlet;
+typedef struct pakfire_scriptlet pakfire_scriptlet;
-int pakfire_scriptlet_create(struct pakfire_scriptlet** scriptlet,
+int pakfire_scriptlet_create(pakfire_scriptlet** scriptlet,
pakfire_ctx* ctx, const char* type, const char* data, size_t size);
-struct pakfire_scriptlet* pakfire_scriptlet_ref(struct pakfire_scriptlet* scriptlet);
-struct pakfire_scriptlet* pakfire_scriptlet_unref(struct pakfire_scriptlet* scriptlet);
+pakfire_scriptlet* pakfire_scriptlet_ref(pakfire_scriptlet* scriptlet);
+pakfire_scriptlet* pakfire_scriptlet_unref(pakfire_scriptlet* scriptlet);
-const char* pakfire_scriptlet_get_type(struct pakfire_scriptlet* scriptlet);
-const char* pakfire_scriptlet_get_data(struct pakfire_scriptlet* scriptlet, size_t* size);
+const char* pakfire_scriptlet_get_type(pakfire_scriptlet* scriptlet);
+const char* pakfire_scriptlet_get_data(pakfire_scriptlet* scriptlet, size_t* size);
-int pakfire_scriptlet_execute(struct pakfire_scriptlet* scriptlet, struct pakfire* pakfire);
+int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, struct pakfire* pakfire);
#endif /* PAKFIRE_SCRIPTLET_H */
static int pakfire_transaction_run_script(struct pakfire_transaction* transaction,
pakfire_db* db, const char* type, pakfire_package* pkg, pakfire_archive* archive) {
- struct pakfire_scriptlet* scriptlet = NULL;
+ pakfire_scriptlet* scriptlet = NULL;
// Fetch scriptlet from archive if possible
if (archive)