2009-08-17 22:37:20 +05:30
|
|
|
/*-
|
2010-01-19 00:19:32 +05:30
|
|
|
* Copyright (c) 2008-2010 Juan Romero Pardines.
|
2009-08-17 22:37:20 +05:30
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include <xbps_api.h>
|
|
|
|
|
2010-01-21 07:40:19 +05:30
|
|
|
/**
|
|
|
|
* @file lib/unpack.c
|
|
|
|
* @brief Binary package file unpacking routines
|
|
|
|
* @defgroup unpack Binary package file unpacking functions
|
2010-01-23 04:26:39 +05:30
|
|
|
*
|
2010-01-23 10:46:05 +05:30
|
|
|
* Unpacking a binary package involves the following steps:
|
|
|
|
* - Its <b>pre-install</b> target in the INSTALL script is executed
|
|
|
|
* (if available).
|
|
|
|
* - Metadata files are extracted.
|
|
|
|
* - All other kind of files on archive are extracted.
|
|
|
|
* - Handles configuration files by taking care of updating them with
|
|
|
|
* new versions if necessary and to not overwrite modified ones.
|
2010-01-28 20:38:50 +05:30
|
|
|
* - Files from installed package are compared with new package and
|
|
|
|
* obsolete files are removed.
|
2010-01-23 10:46:05 +05:30
|
|
|
* - Finally its state is set to XBPS_PKG_STATE_UNPACKED.
|
|
|
|
*
|
|
|
|
* The following image shown below represents a transaction dictionary
|
|
|
|
* returned by xbps_repository_get_transaction_dict():
|
2010-01-23 04:26:39 +05:30
|
|
|
*
|
|
|
|
* @image html images/xbps_transaction_dictionary.png
|
|
|
|
*
|
|
|
|
* Legend:
|
2010-01-23 10:46:05 +05:30
|
|
|
* - <b>Salmon filled box</b>: The transaction dictionary.
|
|
|
|
* - <b>White filled box</b>: mandatory objects.
|
|
|
|
* - <b>Grey filled box</b>: optional objects.
|
|
|
|
* - <b>Green filled box</b>: possible value set in the object, only one of
|
|
|
|
* them is set.
|
2010-01-23 04:26:39 +05:30
|
|
|
*
|
|
|
|
* Text inside of white boxes are the key associated with the object, its
|
|
|
|
* data type is specified on its edge, i.e string, array, integer, dictionary.
|
2010-01-21 07:40:19 +05:30
|
|
|
*/
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
static void
|
2010-01-28 20:51:08 +05:30
|
|
|
set_extract_flags(int *flags, bool update)
|
2009-08-17 22:37:20 +05:30
|
|
|
{
|
2010-01-28 20:51:08 +05:30
|
|
|
int lflags = 0;
|
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
if (getuid() == 0)
|
2010-01-28 20:51:08 +05:30
|
|
|
lflags = FEXTRACT_FLAGS;
|
2009-08-17 22:37:20 +05:30
|
|
|
else
|
2010-01-28 20:51:08 +05:30
|
|
|
lflags = EXTRACT_FLAGS;
|
|
|
|
|
|
|
|
if (!update) {
|
|
|
|
/*
|
|
|
|
* Only overwrite files while updating.
|
|
|
|
*/
|
|
|
|
lflags |= ARCHIVE_EXTRACT_NO_OVERWRITE;
|
|
|
|
lflags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
|
|
|
}
|
|
|
|
|
|
|
|
*flags = lflags;
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: remove printfs and return appropiate errors to be interpreted by
|
|
|
|
* the consumer.
|
|
|
|
*/
|
|
|
|
static int
|
2009-12-02 11:01:03 +05:30
|
|
|
unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
|
2009-08-17 22:37:20 +05:30
|
|
|
{
|
2009-11-19 10:40:42 +05:30
|
|
|
prop_dictionary_t filesd = NULL, old_filesd = NULL;
|
2009-08-17 22:37:20 +05:30
|
|
|
struct archive_entry *entry;
|
2009-12-07 11:54:22 +05:30
|
|
|
size_t entry_idx = 0;
|
2010-01-23 04:26:39 +05:30
|
|
|
const char *pkgname, *version, *rootdir, *entry_str, *transact;
|
|
|
|
char *buf;
|
2010-04-29 03:00:56 +05:30
|
|
|
int rv, flags, lflags;
|
|
|
|
bool preserve, skip_entry, update;
|
2009-12-07 11:54:22 +05:30
|
|
|
bool props_plist_found, files_plist_found;
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
assert(ar != NULL);
|
|
|
|
assert(pkg != NULL);
|
2009-12-02 11:01:03 +05:30
|
|
|
|
2010-04-29 03:00:56 +05:30
|
|
|
preserve = skip_entry = update = false;
|
2009-12-07 11:54:22 +05:30
|
|
|
props_plist_found = files_plist_found = false;
|
2009-08-17 22:37:20 +05:30
|
|
|
rootdir = xbps_get_rootdir();
|
|
|
|
flags = xbps_get_flags();
|
|
|
|
|
|
|
|
if (strcmp(rootdir, "") == 0)
|
|
|
|
rootdir = "/";
|
|
|
|
|
|
|
|
if (chdir(rootdir) == -1)
|
|
|
|
return errno;
|
|
|
|
|
2009-11-23 15:16:51 +05:30
|
|
|
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
|
|
|
|
return errno;
|
|
|
|
if (!prop_dictionary_get_cstring_nocopy(pkg, "version", &version))
|
|
|
|
return errno;
|
2010-01-28 20:38:50 +05:30
|
|
|
|
2009-12-02 11:01:03 +05:30
|
|
|
prop_dictionary_get_bool(pkg, "preserve", &preserve);
|
2010-01-23 04:26:39 +05:30
|
|
|
|
|
|
|
if (!prop_dictionary_get_cstring_nocopy(pkg, "trans-action",
|
|
|
|
&transact))
|
|
|
|
return errno;
|
|
|
|
if (strcmp(transact, "update") == 0)
|
2009-12-09 20:44:35 +05:30
|
|
|
update = true;
|
|
|
|
|
2010-01-19 00:19:32 +05:30
|
|
|
/*
|
2010-01-23 04:26:39 +05:30
|
|
|
* While updating, always remove current INSTALL/REMOVE
|
|
|
|
* scripts, because a package upgrade might not have those
|
|
|
|
* anymore.
|
2010-01-19 00:19:32 +05:30
|
|
|
*/
|
2010-01-23 04:26:39 +05:30
|
|
|
if (update) {
|
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/INSTALL",
|
|
|
|
XBPS_META_PATH, pkgname);
|
|
|
|
if (buf == NULL)
|
|
|
|
return errno;
|
|
|
|
if (access(buf, R_OK|X_OK) == 0) {
|
|
|
|
if (unlink(buf) == -1) {
|
|
|
|
free(buf);
|
2010-01-19 00:19:32 +05:30
|
|
|
return errno;
|
|
|
|
}
|
2010-01-23 04:26:39 +05:30
|
|
|
}
|
|
|
|
free(buf);
|
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/REMOVE",
|
|
|
|
XBPS_META_PATH, pkgname);
|
|
|
|
if (buf == NULL)
|
|
|
|
return errno;
|
|
|
|
if (access(buf, R_OK|X_OK) == 0) {
|
|
|
|
if (unlink(buf) == -1) {
|
|
|
|
free(buf);
|
2010-01-19 00:19:32 +05:30
|
|
|
return errno;
|
|
|
|
}
|
|
|
|
}
|
2010-01-23 04:26:39 +05:30
|
|
|
free(buf);
|
|
|
|
}
|
2010-01-19 00:19:32 +05:30
|
|
|
|
2010-01-23 04:26:39 +05:30
|
|
|
/*
|
|
|
|
* Process the archive files.
|
|
|
|
*/
|
|
|
|
while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
|
|
|
|
entry_str = archive_entry_pathname(entry);
|
2010-01-28 20:51:08 +05:30
|
|
|
set_extract_flags(&lflags, update);
|
2009-08-17 22:37:20 +05:30
|
|
|
/*
|
|
|
|
* Run the pre INSTALL action if the file is there.
|
|
|
|
*/
|
2009-10-21 21:46:17 +05:30
|
|
|
if (strcmp("./INSTALL", entry_str) == 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/INSTALL",
|
|
|
|
XBPS_META_PATH, pkgname);
|
|
|
|
if (buf == NULL)
|
|
|
|
return errno;
|
|
|
|
|
|
|
|
archive_entry_set_pathname(entry, buf);
|
2009-12-11 15:28:46 +05:30
|
|
|
archive_entry_set_mode(entry, 0750);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2009-09-30 21:59:21 +05:30
|
|
|
if (archive_read_extract(ar, entry, lflags) != 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
if ((rv = archive_errno(ar)) != EEXIST) {
|
|
|
|
free(buf);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
2009-12-09 20:44:35 +05:30
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
if ((rv = xbps_file_chdir_exec(rootdir, buf, "pre",
|
2009-12-09 20:44:35 +05:30
|
|
|
pkgname, version, update ? "yes" : "no",
|
|
|
|
NULL)) != 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
free(buf);
|
2010-01-15 19:49:16 +05:30
|
|
|
fprintf(stderr,
|
|
|
|
"%s: preinst action target error %s\n",
|
2009-08-17 22:37:20 +05:30
|
|
|
pkgname, strerror(errno));
|
|
|
|
return rv;
|
|
|
|
}
|
2010-01-23 04:26:39 +05:30
|
|
|
/* Pass to the next entry if successful */
|
2009-08-17 22:37:20 +05:30
|
|
|
free(buf);
|
2009-12-07 11:54:22 +05:30
|
|
|
entry_idx++;
|
2009-08-17 22:37:20 +05:30
|
|
|
continue;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unpack metadata files in final directory.
|
|
|
|
*/
|
2009-10-21 21:46:17 +05:30
|
|
|
} else if (strcmp("./REMOVE", entry_str) == 0) {
|
2010-01-23 04:26:39 +05:30
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/REMOVE",
|
2009-08-17 22:37:20 +05:30
|
|
|
XBPS_META_PATH, pkgname);
|
2010-01-23 04:26:39 +05:30
|
|
|
if (buf == NULL)
|
2009-08-17 22:37:20 +05:30
|
|
|
return errno;
|
2010-01-23 04:26:39 +05:30
|
|
|
archive_entry_set_pathname(entry, buf);
|
|
|
|
free(buf);
|
2009-12-11 15:28:46 +05:30
|
|
|
archive_entry_set_mode(entry, 0750);
|
2010-01-23 04:26:39 +05:30
|
|
|
if (archive_read_extract(ar, entry, lflags) != 0)
|
|
|
|
return archive_errno(ar);
|
|
|
|
|
|
|
|
/* Pass to next entry if successful */
|
|
|
|
entry_idx++;
|
|
|
|
continue;
|
2009-12-11 15:28:46 +05:30
|
|
|
|
2009-10-21 21:46:17 +05:30
|
|
|
} else if (strcmp("./files.plist", entry_str) == 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
/*
|
|
|
|
* Now we have a dictionary from the entry
|
|
|
|
* in memory. Will be written to disk later, when
|
|
|
|
* all files are extracted.
|
|
|
|
*/
|
|
|
|
filesd = xbps_read_dict_from_archive_entry(ar, entry);
|
|
|
|
if (filesd == NULL)
|
|
|
|
return errno;
|
|
|
|
|
|
|
|
/* Pass to next entry */
|
2009-12-07 11:54:22 +05:30
|
|
|
files_plist_found = true;
|
|
|
|
entry_idx++;
|
2009-08-17 22:37:20 +05:30
|
|
|
continue;
|
|
|
|
|
2009-10-21 21:46:17 +05:30
|
|
|
} else if (strcmp("./props.plist", entry_str) == 0) {
|
2010-01-23 04:26:39 +05:30
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/props.plist",
|
2009-08-17 22:37:20 +05:30
|
|
|
XBPS_META_PATH, pkgname);
|
2010-01-23 04:26:39 +05:30
|
|
|
if (buf == NULL)
|
2009-08-17 22:37:20 +05:30
|
|
|
return errno;
|
2010-01-23 04:26:39 +05:30
|
|
|
archive_entry_set_pathname(entry, buf);
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
if (archive_read_extract(ar, entry, lflags) != 0)
|
|
|
|
return archive_errno(ar);
|
|
|
|
|
|
|
|
/* Pass to next entry if successful */
|
2009-12-07 11:54:22 +05:30
|
|
|
props_plist_found = true;
|
2010-01-23 04:26:39 +05:30
|
|
|
entry_idx++;
|
|
|
|
continue;
|
|
|
|
|
2009-10-21 21:46:17 +05:30
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Handle configuration files.
|
|
|
|
*/
|
2009-11-28 10:13:21 +05:30
|
|
|
if ((rv = xbps_config_file_from_archive_entry(filesd,
|
|
|
|
entry, pkgname, &lflags, &skip_entry)) != 0) {
|
2009-10-21 21:46:17 +05:30
|
|
|
prop_object_release(filesd);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
if (skip_entry) {
|
|
|
|
archive_read_data_skip(ar);
|
|
|
|
skip_entry = false;
|
2009-12-07 11:54:22 +05:30
|
|
|
entry_idx++;
|
2009-10-21 21:46:17 +05:30
|
|
|
continue;
|
|
|
|
}
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
2009-10-21 21:46:17 +05:30
|
|
|
|
2010-01-23 04:26:39 +05:30
|
|
|
/*
|
|
|
|
* If XBPS_PKGFILES or XBPS_PKGPROPS weren't found
|
|
|
|
* in the archive at this phase, skip all data.
|
|
|
|
*/
|
|
|
|
if (!files_plist_found || !props_plist_found) {
|
|
|
|
archive_read_data_skip(ar);
|
|
|
|
/*
|
|
|
|
* If we have processed 4 entries and the two
|
|
|
|
* required metadata files weren't found, bail out.
|
|
|
|
* This is not an XBPS binary package.
|
|
|
|
*/
|
|
|
|
if (entry_idx >= 3)
|
|
|
|
return ENOPKG;
|
|
|
|
|
|
|
|
entry_idx++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
/*
|
|
|
|
* Extract entry from archive.
|
|
|
|
*/
|
2009-09-30 21:59:21 +05:30
|
|
|
if (archive_read_extract(ar, entry, lflags) != 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
rv = archive_errno(ar);
|
|
|
|
if (rv != EEXIST) {
|
2010-01-15 19:49:16 +05:30
|
|
|
fprintf(stderr, "ERROR: %s...exiting!\n",
|
2009-08-17 22:37:20 +05:30
|
|
|
archive_error_string(ar));
|
|
|
|
return rv;;
|
|
|
|
} else if (rv == EEXIST) {
|
|
|
|
if (flags & XBPS_FLAG_VERBOSE) {
|
2010-01-15 19:49:16 +05:30
|
|
|
fprintf(stderr,
|
|
|
|
"WARNING: ignoring existent "
|
2009-08-17 22:37:20 +05:30
|
|
|
"path: %s\n",
|
|
|
|
archive_entry_pathname(entry));
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flags & XBPS_FLAG_VERBOSE)
|
|
|
|
printf(" %s\n", archive_entry_pathname(entry));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((rv = archive_errno(ar)) == 0) {
|
2010-01-23 04:26:39 +05:30
|
|
|
buf = xbps_xasprintf(".%s/metadata/%s/files.plist",
|
2009-11-09 07:00:04 +05:30
|
|
|
XBPS_META_PATH, pkgname);
|
2010-01-23 04:26:39 +05:30
|
|
|
if (buf == NULL) {
|
2009-11-09 07:00:04 +05:30
|
|
|
prop_object_release(filesd);
|
|
|
|
return errno;
|
|
|
|
}
|
|
|
|
/*
|
2010-01-28 20:38:50 +05:30
|
|
|
* Check if files.plist exists and pkg is NOT marked as
|
|
|
|
* preserve, in that case we need to check for obsolete files
|
|
|
|
* and remove them if necessary.
|
2009-11-09 07:00:04 +05:30
|
|
|
*/
|
2010-01-28 20:38:50 +05:30
|
|
|
if (!preserve && (access(buf, R_OK) == 0)) {
|
2009-11-09 07:00:04 +05:30
|
|
|
old_filesd =
|
2010-04-20 17:52:38 +05:30
|
|
|
prop_dictionary_internalize_from_zfile(buf);
|
2009-11-09 07:00:04 +05:30
|
|
|
if (old_filesd == NULL) {
|
|
|
|
prop_object_release(filesd);
|
2010-01-23 04:26:39 +05:30
|
|
|
free(buf);
|
2009-11-09 07:00:04 +05:30
|
|
|
return errno;
|
|
|
|
}
|
2009-11-28 10:13:21 +05:30
|
|
|
rv = xbps_remove_obsoletes(old_filesd, filesd);
|
2009-11-09 07:00:04 +05:30
|
|
|
if (rv != 0) {
|
|
|
|
prop_object_release(old_filesd);
|
|
|
|
prop_object_release(filesd);
|
2010-01-23 04:26:39 +05:30
|
|
|
free(buf);
|
2009-11-09 07:00:04 +05:30
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
prop_object_release(old_filesd);
|
|
|
|
}
|
2009-08-17 22:37:20 +05:30
|
|
|
/*
|
|
|
|
* Now that all files were successfully unpacked, we
|
|
|
|
* can safely externalize files.plist because the path
|
|
|
|
* is reachable.
|
|
|
|
*/
|
2010-04-20 17:52:38 +05:30
|
|
|
if (!prop_dictionary_externalize_to_zfile(filesd, buf)) {
|
2009-08-17 22:37:20 +05:30
|
|
|
prop_object_release(filesd);
|
2010-01-23 04:26:39 +05:30
|
|
|
free(buf);
|
2009-08-17 22:37:20 +05:30
|
|
|
return errno;
|
|
|
|
}
|
2010-01-23 04:26:39 +05:30
|
|
|
free(buf);
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
2010-01-19 00:19:32 +05:30
|
|
|
if (filesd)
|
|
|
|
prop_object_release(filesd);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
2010-01-21 07:40:19 +05:30
|
|
|
|
|
|
|
int
|
|
|
|
xbps_unpack_binary_pkg(prop_dictionary_t pkg)
|
|
|
|
{
|
|
|
|
const char *pkgname, *repoloc;
|
|
|
|
struct archive *ar = NULL;
|
|
|
|
char *binfile = NULL;
|
|
|
|
int pkg_fd, rv = 0;
|
|
|
|
|
|
|
|
assert(pkg != NULL);
|
|
|
|
|
|
|
|
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
|
|
|
|
return errno;
|
|
|
|
if (!prop_dictionary_get_cstring_nocopy(pkg, "repository", &repoloc))
|
|
|
|
return errno;
|
|
|
|
binfile = xbps_get_binpkg_local_path(pkg, repoloc);
|
|
|
|
if (binfile == NULL)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
if ((pkg_fd = open(binfile, O_RDONLY)) == -1) {
|
|
|
|
rv = errno;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
ar = archive_read_new();
|
|
|
|
if (ar == NULL) {
|
|
|
|
rv = errno;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable support for tar format and all compression methods.
|
|
|
|
*/
|
|
|
|
archive_read_support_compression_all(ar);
|
|
|
|
archive_read_support_format_tar(ar);
|
|
|
|
|
|
|
|
if ((rv = archive_read_open_fd(ar, pkg_fd,
|
|
|
|
ARCHIVE_READ_BLOCKSIZE)) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2010-01-23 04:26:39 +05:30
|
|
|
if ((rv = unpack_archive_fini(ar, pkg)) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set package state to unpacked.
|
|
|
|
*/
|
|
|
|
rv = xbps_set_pkg_state_installed(pkgname, XBPS_PKG_STATE_UNPACKED);
|
2010-01-21 07:40:19 +05:30
|
|
|
|
|
|
|
out:
|
|
|
|
if (ar)
|
|
|
|
archive_read_finish(ar);
|
|
|
|
if (pkg_fd != -1)
|
|
|
|
(void)close(pkg_fd);
|
|
|
|
if (binfile)
|
|
|
|
free(binfile);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|