diff -r c9c90315ea24 -r d7eea3164151 librazor/importer.c --- a/librazor/importer.c Wed Apr 22 15:09:17 2009 +0100 +++ b/librazor/importer.c Thu Jul 02 11:31:45 2009 +0100 @@ -1,6 +1,7 @@ /* * Copyright (C) 2008 Kristian Høgsberg * Copyright (C) 2008 Red Hat, Inc + * Copyright (C) 2009 J. Ali Harlow * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,6 +83,7 @@ const char *version, const char *arch) { + uint32_t empty; struct razor_package *p; p = array_add(&importer->set->packages, sizeof *p); @@ -92,6 +94,12 @@ importer->package = p; array_init(&importer->properties); + + empty = hashtable_tokenize(&importer->details_table, ""); + importer->package->preun.program = empty; + importer->package->preun.body = empty; + importer->package->postun.program = empty; + importer->package->postun.body = empty; } /** @@ -135,6 +143,39 @@ } /** + * razor_importer_add_script: + * @importer: the %razor_importer + * @script: either %RAZOR_PROPERTY_PREUN or %RAZOR_PROPERTY_POSTUN + * @program: the program to run the script + * @body: the body of the script + * + * Provide a script to use when uninstalling the current package. + **/ +RAZOR_EXPORT void +razor_importer_add_script(struct razor_importer *importer, + enum razor_property_flags script, + const char *program, + const char *body) +{ + switch (script) { + case RAZOR_PROPERTY_PREUN: + importer->package->preun.program = + hashtable_tokenize(&importer->table, program); + importer->package->preun.body = + hashtable_tokenize(&importer->table, body); + break; + case RAZOR_PROPERTY_POSTUN: + importer->package->postun.program = + hashtable_tokenize(&importer->table, program); + importer->package->postun.body = + hashtable_tokenize(&importer->table, body); + break; + default: + break; + } +} + +/** * razor_importer_add_property: * @importer: the %razor_importer * @name: name of the property