summaryrefslogtreecommitdiff
path: root/src/add.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-22 20:47:21 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-22 20:47:21 +0300
commit718ef3079ea18fcb588264d26e3316628ad18ba0 (patch)
tree7a945f9ad7510096854bb2f599271b7a73aafa95 /src/add.c
parent9b77c053e8fd03348ed04ba09ceaaf7ba99ca6f6 (diff)
downloadapk-tools-718ef3079ea18fcb588264d26e3316628ad18ba0.tar.gz
apk-tools-718ef3079ea18fcb588264d26e3316628ad18ba0.tar.bz2
apk-tools-718ef3079ea18fcb588264d26e3316628ad18ba0.tar.xz
apk-tools-718ef3079ea18fcb588264d26e3316628ad18ba0.zip
add: fixes to installing non-repository package
make sure cache is enabled on non-permanent rootfs setups. some optimizations and fixes too.
Diffstat (limited to 'src/add.c')
-rw-r--r--src/add.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/add.c b/src/add.c
index 4dd93e9..0b402fe 100644
--- a/src/add.c
+++ b/src/add.c
@@ -116,17 +116,27 @@ static int add_main(void *ctx, int argc, char **argv)
struct apk_dependency dep;
if (strstr(argv[i], ".apk") != NULL) {
- struct apk_package *pkg;
+ struct apk_package *pkg = NULL;
struct apk_sign_ctx sctx;
- apk_sign_ctx_init(&sctx, APK_SIGN_VERIFY, NULL);
+ if (!apk_db_cache_active(&db) &&
+ !apk_db_permanent(&db) &&
+ !(apk_flags & APK_FORCE)) {
+ apk_error("Use --force or enable package "
+ "caching to install non-repository "
+ "packages.");
+ goto err;
+ }
+
+ /* FIXME: should verify the package too */
+ apk_sign_ctx_init(&sctx, APK_SIGN_GENERATE, NULL);
r = apk_pkg_read(&db, argv[i], &sctx, &pkg);
apk_sign_ctx_free(&sctx);
if (r != 0) {
apk_error("%s: %s", argv[i], apk_error_str(r));
goto err;
- }
+ }
apk_dep_from_pkg(&dep, &db, pkg);
} else {
r = apk_dep_from_blob(&dep, &db, APK_BLOB_STR(argv[i]));