Support RPM_INSTALL_PREFIX{n} during uninstall
authorJ. Ali Harlow <ali@juiblex.co.uk>
Fri Jul 03 18:02:33 2009 +0100 (2009-07-03)
changeset 3726e93e5485947
parent 371 d7eea3164151
child 373 fda83d91e600
Support RPM_INSTALL_PREFIX{n} during uninstall
librazor/importer.c
librazor/merger.c
librazor/razor-internal.h
librazor/razor.c
librazor/razor.h
librazor/rpm.c
librazor/util.c
src/import-rpmdb.c
src/main.c
test/remove.sh
     1.1 --- a/librazor/importer.c	Thu Jul 02 11:31:45 2009 +0100
     1.2 +++ b/librazor/importer.c	Fri Jul 03 18:02:33 2009 +0100
     1.3 @@ -94,6 +94,7 @@
     1.4  
     1.5  	importer->package = p;
     1.6  	array_init(&importer->properties);
     1.7 +	array_init(&importer->install_prefixes);
     1.8  
     1.9  	empty = hashtable_tokenize(&importer->details_table, "");
    1.10  	importer->package->preun.program = empty;
    1.11 @@ -116,7 +117,13 @@
    1.12  		       &importer->properties,
    1.13  		       1);
    1.14  
    1.15 +	list_set_array(&importer->package->install_prefixes,
    1.16 +		       &importer->set->prefix_pool,
    1.17 +		       &importer->install_prefixes,
    1.18 +		       0);
    1.19 +
    1.20  	array_release(&importer->properties);
    1.21 +	array_release(&importer->install_prefixes);
    1.22  }
    1.23  
    1.24  /**
    1.25 @@ -176,6 +183,23 @@
    1.26  }
    1.27  
    1.28  /**
    1.29 + * razor_importer_add_install_prefixes:
    1.30 + * @importer: the %razor_importer
    1.31 + * @install_prefix: the relocated prefix
    1.32 + *
    1.33 + * Adds a relocated prefix for the current package.
    1.34 + **/
    1.35 +RAZOR_EXPORT void
    1.36 +razor_importer_add_install_prefix(struct razor_importer *importer,
    1.37 +				  const char *install_prefix)
    1.38 +{
    1.39 +	uint32_t *r;
    1.40 +
    1.41 +	r = array_add(&importer->install_prefixes, sizeof *r);
    1.42 +	*r = hashtable_tokenize(&importer->table, install_prefix);
    1.43 +}
    1.44 +
    1.45 +/**
    1.46   * razor_importer_add_property:
    1.47   * @importer: the %razor_importer
    1.48   * @name: name of the property
     2.1 --- a/librazor/merger.c	Thu Jul 02 11:31:45 2009 +0100
     2.2 +++ b/librazor/merger.c	Fri Jul 03 18:02:33 2009 +0100
     2.3 @@ -75,12 +75,13 @@
     2.4  razor_merger_add_package(struct razor_merger *merger,
     2.5  			 struct razor_package *package)
     2.6  {
     2.7 -	char *pool;
     2.8 +	char *pool, *s;
     2.9  	struct list *r;
    2.10  	struct razor_package *p;
    2.11  	struct razor_set *set1;
    2.12  	struct source *source;
    2.13 -	uint32_t flags;
    2.14 +	uint32_t flags, *prefix;
    2.15 +	struct array install_prefixes;
    2.16  
    2.17  	assert(merger->committed == 0);
    2.18  
    2.19 @@ -117,6 +118,18 @@
    2.20  		r = list_next(r);
    2.21  	}
    2.22  
    2.23 +	array_init(&install_prefixes);
    2.24 +	r = list_first(&package->install_prefixes, &source->set->prefix_pool);
    2.25 +	while (r) {
    2.26 +		s = (char *)source->set->string_pool.data + r->data;
    2.27 +		prefix = array_add(&install_prefixes, sizeof *prefix);
    2.28 +		*prefix = hashtable_tokenize(&merger->table, s);
    2.29 +		r = list_next(r);
    2.30 +	}
    2.31 +	list_set_array(&p->install_prefixes, &merger->set->prefix_pool,
    2.32 +                       &install_prefixes, 0);
    2.33 +	array_release(&install_prefixes);
    2.34 +
    2.35  	p->preun.program = hashtable_tokenize(&merger->table,
    2.36  					      &pool[package->preun.program]);
    2.37  	p->preun.body = hashtable_tokenize(&merger->table,
     3.1 --- a/librazor/razor-internal.h	Thu Jul 02 11:31:45 2009 +0100
     3.2 +++ b/librazor/razor-internal.h	Fri Jul 03 18:02:33 2009 +0100
     3.3 @@ -61,6 +61,7 @@
     3.4  #define RAZOR_PROPERTIES		"properties"
     3.5  #define RAZOR_PACKAGE_POOL		"package_pool"
     3.6  #define RAZOR_PROPERTY_POOL		"property_pool"
     3.7 +#define RAZOR_PREFIX_POOL		"prefix_pool"
     3.8  
     3.9  #define RAZOR_DETAILS_STRING_POOL	"details_string_pool"
    3.10  
    3.11 @@ -84,6 +85,7 @@
    3.12  	uint32_t license;
    3.13  	struct list_head properties;
    3.14  	struct list_head files;
    3.15 +	struct list_head install_prefixes;
    3.16  	struct razor_script preun;
    3.17  	struct razor_script postun;
    3.18  };
    3.19 @@ -113,6 +115,7 @@
    3.20  	struct array package_pool;
    3.21   	struct array property_pool;
    3.22   	struct array file_pool;
    3.23 + 	struct array prefix_pool;
    3.24  	struct array file_string_pool;
    3.25  	struct array details_string_pool;
    3.26  
    3.27 @@ -147,6 +150,7 @@
    3.28  	struct array properties;
    3.29  	struct array files;
    3.30  	struct array file_requires;
    3.31 +	struct array install_prefixes;
    3.32  };
    3.33  
    3.34  struct razor_package_iterator {
    3.35 @@ -220,4 +224,16 @@
    3.36  razor_qsort_with_data(void *base, size_t nelem, size_t size,
    3.37  		      razor_compare_with_data_func_t compare, void *data);
    3.38  
    3.39 +struct environment {
    3.40 +	int is_set;
    3.41 +	struct array vars, string_pool;
    3.42 +};
    3.43 +
    3.44 +void environment_init(struct environment *env);
    3.45 +void environment_add_variable(struct environment *env,
    3.46 +			      const char *variable, const char *value);
    3.47 +void environment_set(struct environment *env);
    3.48 +void environment_unset(struct environment *env);
    3.49 +void environment_release(struct environment *env);
    3.50 +
    3.51  #endif /* _RAZOR_INTERNAL_H_ */
     4.1 --- a/librazor/razor.c	Thu Jul 02 11:31:45 2009 +0100
     4.2 +++ b/librazor/razor.c	Fri Jul 03 18:02:33 2009 +0100
     4.3 @@ -67,6 +67,7 @@
     4.4  	{ RAZOR_PROPERTIES,	offsetof(struct razor_set, properties) },
     4.5  	{ RAZOR_PACKAGE_POOL,	offsetof(struct razor_set, package_pool) },
     4.6  	{ RAZOR_PROPERTY_POOL,	offsetof(struct razor_set, property_pool) },
     4.7 +	{ RAZOR_PREFIX_POOL,	offsetof(struct razor_set, prefix_pool) },
     4.8  };
     4.9  
    4.10  struct razor_set_section_index razor_files_sections[] = {
    4.11 @@ -377,9 +378,9 @@
    4.12  }
    4.13  
    4.14  static const char *
    4.15 -razor_package_get_details_type(struct razor_set *set,
    4.16 -			       struct razor_package *package,
    4.17 -			       enum razor_detail_type type)
    4.18 +razor_package_get_details_string(struct razor_set *set,
    4.19 +				 struct razor_package *package,
    4.20 +				 enum razor_detail_type type)
    4.21  {
    4.22  	const char *pool;
    4.23  
    4.24 @@ -434,6 +435,24 @@
    4.25  	}
    4.26  }
    4.27  
    4.28 +static const char *const *
    4.29 +razor_package_get_details_array(struct razor_set *set,
    4.30 +				struct razor_package *package,
    4.31 +				enum razor_detail_type type)
    4.32 +{
    4.33 +	switch (type) {
    4.34 +	case RAZOR_DETAIL_PREFIXES:
    4.35 +		/* We don't track prefixes in packages. Install prefixes
    4.36 +		 * are tracked, but we don't provide an API to get them.
    4.37 +		 */
    4.38 +		return NULL;
    4.39 +
    4.40 +	default:
    4.41 +		fprintf(stderr, "type %u not found\n", type);
    4.42 +		return NULL;
    4.43 +	}
    4.44 +}
    4.45 +
    4.46  /**
    4.47   * razor_package_get_details_varg:
    4.48   * @set: a %razor_set
    4.49 @@ -447,14 +466,22 @@
    4.50  {
    4.51  	int i;
    4.52  	enum razor_detail_type type;
    4.53 -	const char **data;
    4.54 +	const char **string;
    4.55 +	const char *const **array;
    4.56  
    4.57  	for (i = 0;; i += 2) {
    4.58  		type = va_arg(args, enum razor_detail_type);
    4.59  		if (type == RAZOR_DETAIL_LAST)
    4.60  			break;
    4.61 -		data = va_arg(args, const char **);
    4.62 -		*data = razor_package_get_details_type(set, package, type);
    4.63 +		if (type == RAZOR_DETAIL_PREFIXES) {
    4.64 +			array = va_arg(args, const char *const **);
    4.65 +			*array = razor_package_get_details_array(set, package,
    4.66 +								 type);
    4.67 +		} else {
    4.68 +			string = va_arg(args, const char **);
    4.69 +			*string = razor_package_get_details_string(set, package,
    4.70 +								   type);
    4.71 +		}
    4.72  	}
    4.73  
    4.74  }
    4.75 @@ -501,7 +528,10 @@
    4.76  	struct razor_package *p;
    4.77  	char buffer[PATH_MAX];
    4.78  	const char *name, *program, *script;
    4.79 -	int retval = 0, count;
    4.80 +	int retval = 0, i, count;
    4.81 +	struct environment env;
    4.82 +	struct list *link;
    4.83 +	const char *prefix;
    4.84  
    4.85  	razor_package_get_details(set, package,
    4.86  				  RAZOR_DETAIL_PREUNPROG, &program,
    4.87 @@ -535,7 +565,22 @@
    4.88  				  RAZOR_DETAIL_POSTUN, &script,
    4.89  				  RAZOR_DETAIL_LAST);
    4.90  
    4.91 -	return razor_run_script(root, RAZOR_PROPERTY_POSTUN, program, script);
    4.92 +	environment_init(&env);
    4.93 +	link = list_first(&package->install_prefixes, &set->prefix_pool);
    4.94 +	for (i = 0; link; i++) {
    4.95 +		prefix = (const char *)set->string_pool.data + link->data;
    4.96 +		sprintf(buffer, "RPM_INSTALL_PREFIX%d", i);
    4.97 +		environment_add_variable(&env, buffer, prefix);
    4.98 +		link = list_next(link);
    4.99 +	}
   4.100 +	environment_set(&env);
   4.101 +
   4.102 +	retval = razor_run_script(root, RAZOR_PROPERTY_POSTUN, program, script);
   4.103 +
   4.104 +	environment_unset(&env);
   4.105 +	environment_release(&env);
   4.106 +
   4.107 +	return retval;
   4.108  }
   4.109  
   4.110  RAZOR_EXPORT const char *
     5.1 --- a/librazor/razor.h	Thu Jul 02 11:31:45 2009 +0100
     5.2 +++ b/librazor/razor.h	Fri Jul 03 18:02:33 2009 +0100
     5.3 @@ -41,7 +41,8 @@
     5.4  	RAZOR_DETAIL_PREUNPROG,
     5.5  	RAZOR_DETAIL_PREUN,
     5.6  	RAZOR_DETAIL_POSTUNPROG,
     5.7 -	RAZOR_DETAIL_POSTUN
     5.8 +	RAZOR_DETAIL_POSTUN,
     5.9 +	RAZOR_DETAIL_PREFIXES
    5.10  };
    5.11  
    5.12  enum razor_property_flags {
    5.13 @@ -349,6 +350,8 @@
    5.14  			       enum razor_property_flags script,
    5.15  			       const char *program,
    5.16  			       const char *body);
    5.17 +void razor_importer_add_install_prefix(struct razor_importer *importer,
    5.18 +				       const char *install_prefix);
    5.19  void razor_importer_add_property(struct razor_importer *importer,
    5.20  				 const char *name,
    5.21  				 uint32_t flags,
     6.1 --- a/librazor/rpm.c	Thu Jul 02 11:31:45 2009 +0100
     6.2 +++ b/librazor/rpm.c	Fri Jul 03 18:02:33 2009 +0100
     6.3 @@ -509,7 +509,7 @@
     6.4  }
     6.5  
     6.6  static const char *
     6.7 -razor_rpm_get_details_type(struct razor_rpm *rpm, enum razor_detail_type type)
     6.8 +razor_rpm_get_details_string(struct razor_rpm *rpm, enum razor_detail_type type)
     6.9  {
    6.10  	switch(type) {
    6.11  	case RAZOR_DETAIL_NAME:
    6.12 @@ -553,19 +553,39 @@
    6.13  	}
    6.14  }
    6.15  
    6.16 +static const char *const *
    6.17 +razor_rpm_get_details_array(struct razor_rpm *rpm, enum razor_detail_type type)
    6.18 +{
    6.19 +	switch(type) {
    6.20 +	case RAZOR_DETAIL_PREFIXES:
    6.21 +		return rpm->prefixes;
    6.22 +
    6.23 +	default:
    6.24 +		/* Impossible */
    6.25 +		fprintf(stderr, "type %u not found\n", type);
    6.26 +		return NULL;
    6.27 +	}
    6.28 +}
    6.29 +
    6.30  void
    6.31  razor_rpm_get_details_varg(struct razor_rpm *rpm, va_list args)
    6.32  {
    6.33  	int i;
    6.34  	enum razor_detail_type type;
    6.35 -	const char **data;
    6.36 +	const char **string;
    6.37 +	const char *const **array;
    6.38  
    6.39  	for (i = 0;; i += 2) {
    6.40  		type = va_arg(args, enum razor_detail_type);
    6.41  		if (type == RAZOR_DETAIL_LAST)
    6.42  			break;
    6.43 -		data = va_arg(args, const char **);
    6.44 -                *data = razor_rpm_get_details_type(rpm, type);
    6.45 +		if (type == RAZOR_DETAIL_PREFIXES) {
    6.46 +			array = va_arg(args, const char *const **);
    6.47 +			*array = razor_rpm_get_details_array(rpm, type);
    6.48 +		} else {
    6.49 +			string = va_arg(args, const char **);
    6.50 +			*string = razor_rpm_get_details_string(rpm, type);
    6.51 +		}
    6.52          }
    6.53  }
    6.54  
    6.55 @@ -635,11 +655,12 @@
    6.56  
    6.57  	prefix = razor_rpm_get_indirect(rpm, RPMTAG_PREFIXES, &count);
    6.58  	if (prefix) {
    6.59 -		rpm->prefixes = calloc(count, sizeof *rpm->prefixes);
    6.60 +		rpm->prefixes = calloc(count + 1, sizeof *rpm->prefixes);
    6.61  		for (i = 0; i < count; i++) {
    6.62  			rpm->prefixes[i] = prefix;
    6.63  			prefix += strlen(prefix) + 1;
    6.64  		}
    6.65 +		rpm->prefixes[i] = NULL;
    6.66  		rpm->n_prefixes = count;
    6.67  	} else {
    6.68  		prefix = razor_rpm_get_indirect(rpm, RPMTAG_DEFAULTPREFIX,
    6.69 @@ -935,7 +956,7 @@
    6.70  	struct razor_rpm *rpm = installer->rpm;
    6.71  	const char *script = NULL, *program = NULL, *prefix;
    6.72  	char buf[32], *p;
    6.73 -	struct array prefix_pool;
    6.74 +	struct environment env;
    6.75  
    6.76  	program = razor_rpm_get_indirect(rpm, program_tag, NULL);
    6.77  	script = razor_rpm_get_indirect(rpm, script_tag, NULL);
    6.78 @@ -943,16 +964,14 @@
    6.79  		return 0;
    6.80  
    6.81  	if (rpm->relocations) {
    6.82 -		array_init(&prefix_pool);
    6.83 +		environment_init(&env);
    6.84  		for(i = 0; i < rpm->n_prefixes; i++) {
    6.85  			prefix = razor_relocations_apply(rpm->relocations,
    6.86  							 rpm->prefixes[i]);
    6.87  			sprintf(buf, "RPM_INSTALL_PREFIX%d", i);
    6.88 -			p = array_add(&prefix_pool,
    6.89 -				      strlen(buf) + strlen(prefix) + 2);
    6.90 -			sprintf(p, "%s=%s", buf, prefix);
    6.91 -			putenv(p);
    6.92 +			environment_add_variable(&env, buf, prefix);
    6.93  		}
    6.94 +		environment_set(&env);
    6.95  	}
    6.96  
    6.97  	if (program && strcmp(program, "<lua>") == 0)
    6.98 @@ -961,11 +980,8 @@
    6.99  		retval = run_script_external(installer->root, program, script);
   6.100  
   6.101  	if (rpm->relocations) {
   6.102 -		for(i = 0; i < rpm->n_prefixes; i++) {
   6.103 -			sprintf(buf, "RPM_INSTALL_PREFIX%d=", i);
   6.104 -			putenv(buf);
   6.105 -		}
   6.106 -		array_release(&prefix_pool);
   6.107 +		environment_unset(&env);
   6.108 +		environment_release(&env);
   6.109  	}
   6.110  
   6.111  	return retval;
     7.1 --- a/librazor/util.c	Thu Jul 02 11:31:45 2009 +0100
     7.2 +++ b/librazor/util.c	Fri Jul 03 18:02:33 2009 +0100
     7.3 @@ -36,6 +36,7 @@
     7.4  #if HAVE_SYS_MMAN_H
     7.5  #include <sys/mman.h>
     7.6  #endif
     7.7 +#include <assert.h>
     7.8  
     7.9  #include "razor.h"
    7.10  #include "razor-internal.h"
    7.11 @@ -293,3 +294,71 @@
    7.12  
    7.13  	return map;
    7.14  }
    7.15 +
    7.16 +void environment_init(struct environment *env)
    7.17 +{
    7.18 +	env->is_set = 0;
    7.19 +	array_init(&env->string_pool);
    7.20 +	array_init(&env->vars);
    7.21 +}
    7.22 +
    7.23 +void environment_add_variable(struct environment *env,
    7.24 +			      const char *variable, const char *value)
    7.25 +{
    7.26 +	char *s;
    7.27 +	uint32_t *r;
    7.28 +	assert(!env->is_set);
    7.29 +
    7.30 +	s = array_add(&env->string_pool,
    7.31 +		      strlen(variable) + strlen(value) + 2);
    7.32 +	sprintf(s, "%s=%s", variable, value);
    7.33 +	r = array_add(&env->vars, sizeof *r);
    7.34 +	*r = s - (char *)env->string_pool.data;
    7.35 +}
    7.36 +
    7.37 +void environment_set(struct environment *env)
    7.38 +{
    7.39 +	int i, count;
    7.40 +	char *s;
    7.41 +        uint32_t *r;
    7.42 +
    7.43 +	if (!env->is_set) {
    7.44 +		count = env->vars.size / sizeof(uint32_t);
    7.45 +		r = (uint32_t *)env->vars.data;
    7.46 +		for (i = 0; i < count; i++) {
    7.47 +			s = env->string_pool.data + *r++;
    7.48 +			putenv(s);
    7.49 +		}
    7.50 +
    7.51 +		env->is_set = 1;
    7.52 +	}
    7.53 +}
    7.54 +
    7.55 +void environment_unset(struct environment *env)
    7.56 +{
    7.57 +	int i, count;
    7.58 +	char c, *s, *t;
    7.59 +        uint32_t *r;
    7.60 +
    7.61 +	if (env->is_set) {
    7.62 +		count = env->vars.size / sizeof(uint32_t);
    7.63 +		r = (uint32_t *)env->vars.data;
    7.64 +		for (i = 0; i < count; i++) {
    7.65 +			s = env->string_pool.data + *r++;
    7.66 +			t = strchr(s, '=') + 1;
    7.67 +			c = *t;
    7.68 +			*t = '\0';
    7.69 +			putenv(s);
    7.70 +			*t = c;
    7.71 +		}
    7.72 +
    7.73 +		env->is_set = 0;
    7.74 +	}
    7.75 +}
    7.76 +
    7.77 +void environment_release(struct environment *env)
    7.78 +{
    7.79 +	environment_unset(env);
    7.80 +	array_release(&env->string_pool);
    7.81 +	array_release(&env->vars);
    7.82 +}
     8.1 --- a/src/import-rpmdb.c	Thu Jul 02 11:31:45 2009 +0100
     8.2 +++ b/src/import-rpmdb.c	Fri Jul 03 18:02:33 2009 +0100
     8.3 @@ -105,6 +105,7 @@
     8.4  	union rpm_entry name, epoch, version, release, arch;
     8.5  	union rpm_entry summary, description, url, license;
     8.6  	union rpm_entry basenames, dirnames, dirindexes;
     8.7 +	union rpm_entry install_prefixes;
     8.8  	char filename[PATH_MAX], evr[128], buf[16];
     8.9  	rpmdb db;
    8.10  	int imported_count = 0;
    8.11 @@ -185,6 +186,12 @@
    8.12  		add_script(importer, RAZOR_PROPERTY_POSTUN, h,
    8.13  			   RPMTAG_POSTUNPROG, RPMTAG_POSTUN);
    8.14  
    8.15 +		headerGetEntry(h, RPMTAG_INSTPREFIXES, &type,
    8.16 +			       &install_prefixes.p, &count);
    8.17 +		for (i = 0; i < count; i++)
    8.18 +			razor_importer_add_install_prefix(importer,
    8.19 +							  install_prefixes.list[i]);
    8.20 +
    8.21  		razor_importer_finish_package(importer);
    8.22  
    8.23  		printf("\rimporting %d", ++imported_count);
     9.1 --- a/src/main.c	Thu Jul 02 11:31:45 2009 +0100
     9.2 +++ b/src/main.c	Fri Jul 03 18:02:33 2009 +0100
     9.3 @@ -808,6 +808,7 @@
     9.4  static struct razor_set *
     9.5  relocate_packages(struct razor_set *set, struct razor_relocations *relocations)
     9.6  {
     9.7 +	int i;
     9.8  	struct razor_importer *importer;
     9.9  	struct razor_property_iterator *prop_iter;
    9.10  	struct razor_package_iterator *pkg_iter;
    9.11 @@ -817,6 +818,8 @@
    9.12  	struct razor_rpm *rpm;
    9.13  	const char *name, *version, *arch, *summary, *desc, *url, *license;
    9.14  	const char *preunprog, *preun, *postunprog, *postun;
    9.15 +	const char *install_prefix;
    9.16 +	const char *const *prefixes;
    9.17  	char file[PATH_MAX];
    9.18  	uint32_t flags;
    9.19  
    9.20 @@ -847,12 +850,22 @@
    9.21  		}
    9.22  
    9.23  		razor_relocations_set_rpm(relocations, rpm);
    9.24 -		razor_rpm_close(rpm);
    9.25  
    9.26  		razor_importer_begin_package(importer, name, version, arch);
    9.27  		razor_importer_add_details(importer,
    9.28  					   summary, desc, url, license);
    9.29  
    9.30 +		razor_rpm_get_details(rpm, RAZOR_DETAIL_PREFIXES, &prefixes,
    9.31 +				      RAZOR_DETAIL_LAST);
    9.32 +		for (i = 0; prefixes && prefixes[i]; i++) {
    9.33 +			install_prefix = razor_relocations_apply(relocations,
    9.34 +								 prefixes[i]);
    9.35 +			razor_importer_add_install_prefix(importer,
    9.36 +							  install_prefix);
    9.37 +		}
    9.38 +
    9.39 +		razor_rpm_close(rpm);
    9.40 +
    9.41  		prop_iter = razor_property_iterator_create(set, package);
    9.42  		while (razor_property_iterator_next(prop_iter, &property,
    9.43  						    &name, &flags, &version))
    10.1 --- a/test/remove.sh	Thu Jul 02 11:31:45 2009 +0100
    10.2 +++ b/test/remove.sh	Fri Jul 03 18:02:33 2009 +0100
    10.3 @@ -58,20 +58,20 @@
    10.4  ../src/razor init || exit 1
    10.5  export YUM_URL="file://localhost/`pwd`"
    10.6  ../src/razor import-yum || exit 1
    10.7 -../src/razor install zip || exit 1
    10.8 -fs_check_file /usr/var/lib/zip/data.zap
    10.9 +../src/razor install --relocate /usr=/opt zip || exit 1
   10.10 +fs_check_file /opt/var/lib/zip/data.zap
   10.11  ../src/razor remove zip || exit 1
   10.12 -check_file /usr/bin/zap
   10.13 -check_no_file /usr/bin/zip
   10.14 -fs_check_no_file /usr/var/lib/zip/data.zap
   10.15 -../src/razor install zsh || exit 1
   10.16 -../src/razor install zsh2 || exit 1
   10.17 +check_file /opt/bin/zap
   10.18 +check_no_file /opt/bin/zip
   10.19 +fs_check_no_file /opt/var/lib/zip/data.zap
   10.20 +../src/razor install --relocate /usr=/opt zsh || exit 1
   10.21 +../src/razor install --relocate /usr=/opt zsh2 || exit 1
   10.22  ../src/razor remove zsh || exit 1
   10.23  check_file /etc/zsh.conf
   10.24 -check_no_file /usr/bin/zsh
   10.25 -../src/razor install zsh2 || exit 1
   10.26 -../src/razor install zsh2 || exit 1
   10.27 -fs_check_file /usr/var/lib/zip/data.zap
   10.28 +check_no_file /opt/bin/zsh
   10.29 +check_no_file /opt/var/lib/zsh/data.zip
   10.30 +../src/razor install --relocate /usr=/opt zsh2 || exit 1
   10.31 +fs_check_file /opt/var/lib/zip/data.zap
   10.32  ../src/razor remove zsh2 zip || exit 1
   10.33 -fs_check_no_file /usr/var/lib/zip/data.zap
   10.34 +fs_check_no_file /opt/var/lib/zip/data.zap
   10.35  rm -rf "$RAZOR_ROOT"