diff -r 008c75a5e08d -r 644b648173b0 librazor/razor.c --- a/librazor/razor.c Mon Jul 04 10:48:18 2016 +0100 +++ b/librazor/razor.c Thu Jul 14 11:43:16 2016 +0100 @@ -621,13 +621,13 @@ RAZOR_EXPORT int razor_package_remove(struct razor_set *prev, struct razor_set *next, struct razor_atomic *atomic, struct razor_package *package, - const char *root, int install_count, + const char *root_uri, int install_count, enum razor_stage_type stage) { struct razor_file_iterator *fi; struct razor_package_iterator *pi; struct razor_package *p; - char *buffer, buf[32]; + char *uri, *relative, *buffer, buf[32]; const char *name, *program, *script; int i, count, retval = 0; struct environment env; @@ -655,8 +655,9 @@ RAZOR_DETAIL_PREUN, &script, RAZOR_DETAIL_LAST); - retval = razor_run_script(root, RAZOR_PROPERTY_PREUN, program, - script, install_count, &tmp_error); + retval = razor_run_script(root_uri, RAZOR_PROPERTY_PREUN, + program, script, install_count, + &tmp_error); if (retval < 0) { razor_atomic_propagate_error(atomic, tmp_error, NULL); @@ -675,9 +676,34 @@ count++; razor_package_iterator_destroy(pi); if (count <= 0) { - buffer = razor_concat(root, name, NULL); - razor_atomic_remove(atomic, buffer); - free(buffer); + uri = razor_path_to_uri(name); + + if (str_has_prefix(uri, "file:///")) + relative = uri + 8; + else if (str_has_prefix(uri, "file:/")) + relative = uri + 6; + else if (str_has_prefix(uri, "file:")) + relative = uri + 5; + else if (str_has_prefix(uri, "/")) + relative = uri + 1; + else + relative = uri; + + buffer = razor_resolve_uri_root(root_uri, + relative, 1, + &tmp_error); + free(uri); + + if (buffer) { + razor_atomic_remove(atomic, buffer); + free(buffer); + } else { + razor_atomic_propagate_error(atomic, + tmp_error, + NULL); + tmp_error = NULL; + break; + } } } @@ -692,8 +718,9 @@ RAZOR_DETAIL_POSTUN, &script, RAZOR_DETAIL_LAST); - retval |= razor_run_script(root, RAZOR_PROPERTY_POSTUN, program, - script, install_count, &tmp_error); + retval |= razor_run_script(root_uri, RAZOR_PROPERTY_POSTUN, + program, script, install_count, + &tmp_error); if (retval < 0) { razor_atomic_propagate_error(atomic, tmp_error, NULL);