diff options
Diffstat (limited to 'src/install.c')
-rw-r--r-- | src/install.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/src/install.c b/src/install.c index 29cee37..24725f8 100644 --- a/src/install.c +++ b/src/install.c @@ -42,7 +42,7 @@ int metadata_remove(const char *_path) { /** * Install a package and its dependencies into a destination root. * The destination is created if it does not exist. - * @param destroot directory to install package + * @param _destroot directory to install package * @param _package name of archive to install (not a path) * @return success=0, error=-1 (general), -2 (unable to create `destroot`) */ @@ -63,7 +63,6 @@ int install(const char *destroot, const char *_package) { } } - char cwd[PATH_MAX]; char source[PATH_MAX]; char template[PATH_MAX]; @@ -90,44 +89,8 @@ int install(const char *destroot, const char *_package) { } tar_extract_archive(package, tmpdir); - getcwd(cwd, sizeof(cwd)); - - RelocationEntry **b_record = NULL; - RelocationEntry **t_record = NULL; - chdir(tmpdir); - { - // Rewrite binary prefixes - b_record = prefixes_read(SPM_META_PREFIX_BIN); - if (b_record) { - for (int i = 0; b_record[i] != NULL; i++) { - if (file_is_binexec(b_record[i]->path)) { - if (SPM_GLOBAL.verbose) { - printf("Relocate RPATH: %s\n", b_record[i]->path); - } - rpath_autoset(b_record[i]->path); - } - if (SPM_GLOBAL.verbose) { - printf("Relocate DATA : %s\n", b_record[i]->path); - } - relocate(b_record[i]->path, b_record[i]->prefix, destroot); - } - } - - // Rewrite text prefixes - t_record = prefixes_read(SPM_META_PREFIX_TEXT); - if (t_record) { - for (int i = 0; t_record[i] != NULL; i++) { - if (SPM_GLOBAL.verbose) { - printf("Relocate TEXT : %s\n", t_record[i]->path); - } - file_replace_text(t_record[i]->path, t_record[i]->prefix, destroot); - } - } - - prefixes_free(b_record); - prefixes_free(t_record); - } - chdir(cwd); + // Relocate temporary directory + relocate_root(destroot, tmpdir); // Append a trailing slash to tmpdir to direct rsync to copy files, not the directory, into destroot sprintf(source, "%s%c", tmpdir, DIRSEP); |