librazor/rpm.c
changeset 422 6fa783097ca1
parent 403 e63951c1d0f8
child 424 8cbc438cc298
     1.1 --- a/librazor/rpm.c	Thu Nov 10 10:35:21 2011 +0000
     1.2 +++ b/librazor/rpm.c	Sat Feb 11 09:49:58 2012 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5   * Copyright (C) 2008  Kristian Høgsberg <krh@redhat.com>
     1.6   * Copyright (C) 2008  Red Hat, Inc
     1.7 - * Copyright (C) 2009, 2011  J. Ali Harlow <ali@juiblex.co.uk>
     1.8 + * Copyright (C) 2009, 2011, 2012  J. Ali Harlow <ali@juiblex.co.uk>
     1.9   *
    1.10   * This program is free software; you can redistribute it and/or modify
    1.11   * it under the terms of the GNU General Public License as published by
    1.12 @@ -1141,6 +1141,7 @@
    1.13  	const char *path, *name;
    1.14  	size_t filesize;
    1.15  	char *s;
    1.16 +	int retval = 0;
    1.17  
    1.18  	assert (rpm != NULL);
    1.19  	assert (root != NULL);
    1.20 @@ -1161,10 +1162,10 @@
    1.21  		razor_relocations_set_rpm(rpm->relocations, rpm);
    1.22  
    1.23  	if (stage & RAZOR_STAGE_SCRIPTS_PRE)
    1.24 -		run_script(&installer, RPMTAG_PREINPROG, RPMTAG_PREIN,
    1.25 -			   install_count);
    1.26 +		retval = run_script(&installer, RPMTAG_PREINPROG, RPMTAG_PREIN,
    1.27 +				    install_count);
    1.28  
    1.29 -	if (stage & RAZOR_STAGE_FILES) {
    1.30 +	if (!retval && (stage & RAZOR_STAGE_FILES)) {
    1.31  		if (installer_init(&installer))
    1.32  			return -1;
    1.33  
    1.34 @@ -1205,13 +1206,15 @@
    1.35  
    1.36  		if (installer_finish(&installer))
    1.37  			return -1;
    1.38 +
    1.39 +		retval = razor_atomic_in_error_state(atomic);
    1.40  	}
    1.41  
    1.42 -	if (stage & RAZOR_STAGE_SCRIPTS_POST)
    1.43 -		run_script(&installer, RPMTAG_POSTINPROG, RPMTAG_POSTIN,
    1.44 -			   install_count);
    1.45 +	if (!retval && (stage & RAZOR_STAGE_SCRIPTS_POST))
    1.46 +		retval = run_script(&installer, RPMTAG_POSTINPROG,
    1.47 +				    RPMTAG_POSTIN, install_count);
    1.48  
    1.49 -	return 0;
    1.50 +	return retval;
    1.51  }
    1.52  
    1.53  RAZOR_EXPORT int