1.1 --- a/librazor/razor.c Sat Feb 11 09:34:40 2012 +0000
1.2 +++ b/librazor/razor.c Sat Feb 11 09:49:58 2012 +0000
1.3 @@ -635,7 +635,7 @@
1.4 struct razor_package *p;
1.5 char *buffer, buf[32];
1.6 const char *name, *program, *script;
1.7 - int i, count;
1.8 + int i, count, retval = 0;
1.9 struct environment env;
1.10 struct list *link;
1.11 const char *prefix;
1.12 @@ -660,11 +660,11 @@
1.13 RAZOR_DETAIL_PREUN, &script,
1.14 RAZOR_DETAIL_LAST);
1.15
1.16 - razor_run_script(root, RAZOR_PROPERTY_PREUN, program,
1.17 - script, install_count);
1.18 + retval = razor_run_script(root, RAZOR_PROPERTY_PREUN, program,
1.19 + script, install_count);
1.20 }
1.21
1.22 - if (stage & RAZOR_STAGE_FILES) {
1.23 + if (!retval && (stage & RAZOR_STAGE_FILES)) {
1.24 fi = razor_file_iterator_create(prev, package, 1);
1.25
1.26 while (razor_file_iterator_next(fi, &name)) {
1.27 @@ -682,16 +682,18 @@
1.28 }
1.29
1.30 razor_file_iterator_destroy(fi);
1.31 +
1.32 + retval = razor_atomic_in_error_state(atomic);
1.33 }
1.34
1.35 - if (stage & RAZOR_STAGE_SCRIPTS_POST) {
1.36 + if (!retval && (stage & RAZOR_STAGE_SCRIPTS_POST)) {
1.37 razor_package_get_details(prev, package,
1.38 RAZOR_DETAIL_POSTUNPROG, &program,
1.39 RAZOR_DETAIL_POSTUN, &script,
1.40 RAZOR_DETAIL_LAST);
1.41
1.42 - razor_run_script(root, RAZOR_PROPERTY_POSTUN, program, script,
1.43 - install_count);
1.44 + retval |= razor_run_script(root, RAZOR_PROPERTY_POSTUN, program,
1.45 + script, install_count);
1.46 }
1.47
1.48 if (stage & RAZOR_STAGE_SCRIPTS) {
1.49 @@ -699,7 +701,7 @@
1.50 environment_release(&env);
1.51 }
1.52
1.53 - return razor_atomic_in_error_state(atomic);
1.54 + return retval;
1.55 }
1.56
1.57 RAZOR_EXPORT const char *
2.1 --- a/librazor/rpm.c Sat Feb 11 09:34:40 2012 +0000
2.2 +++ b/librazor/rpm.c Sat Feb 11 09:49:58 2012 +0000
2.3 @@ -1,7 +1,7 @@
2.4 /*
2.5 * Copyright (C) 2008 Kristian Høgsberg <krh@redhat.com>
2.6 * Copyright (C) 2008 Red Hat, Inc
2.7 - * Copyright (C) 2009, 2011 J. Ali Harlow <ali@juiblex.co.uk>
2.8 + * Copyright (C) 2009, 2011, 2012 J. Ali Harlow <ali@juiblex.co.uk>
2.9 *
2.10 * This program is free software; you can redistribute it and/or modify
2.11 * it under the terms of the GNU General Public License as published by
2.12 @@ -1141,6 +1141,7 @@
2.13 const char *path, *name;
2.14 size_t filesize;
2.15 char *s;
2.16 + int retval = 0;
2.17
2.18 assert (rpm != NULL);
2.19 assert (root != NULL);
2.20 @@ -1161,10 +1162,10 @@
2.21 razor_relocations_set_rpm(rpm->relocations, rpm);
2.22
2.23 if (stage & RAZOR_STAGE_SCRIPTS_PRE)
2.24 - run_script(&installer, RPMTAG_PREINPROG, RPMTAG_PREIN,
2.25 - install_count);
2.26 + retval = run_script(&installer, RPMTAG_PREINPROG, RPMTAG_PREIN,
2.27 + install_count);
2.28
2.29 - if (stage & RAZOR_STAGE_FILES) {
2.30 + if (!retval && (stage & RAZOR_STAGE_FILES)) {
2.31 if (installer_init(&installer))
2.32 return -1;
2.33
2.34 @@ -1205,13 +1206,15 @@
2.35
2.36 if (installer_finish(&installer))
2.37 return -1;
2.38 +
2.39 + retval = razor_atomic_in_error_state(atomic);
2.40 }
2.41
2.42 - if (stage & RAZOR_STAGE_SCRIPTS_POST)
2.43 - run_script(&installer, RPMTAG_POSTINPROG, RPMTAG_POSTIN,
2.44 - install_count);
2.45 + if (!retval && (stage & RAZOR_STAGE_SCRIPTS_POST))
2.46 + retval = run_script(&installer, RPMTAG_POSTINPROG,
2.47 + RPMTAG_POSTIN, install_count);
2.48
2.49 - return 0;
2.50 + return retval;
2.51 }
2.52
2.53 RAZOR_EXPORT int