From 1c2894552d88ae64f4102938cbb470b80cf4b35e Mon Sep 17 00:00:00 2001 From: sobomax Date: Fri, 10 May 2002 00:03:14 +0000 Subject: [PATCH] When packing installed package into a file (pkg_create -b) make sure to include all package files into resulting tarball. PR: 34007 Submitted by: olgeni While I here: - Remove bogus comment; - ensure that we return the proper exit code in the case of -b failure. MFC after: 5 days --- usr.sbin/pkg_install/create/perform.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index d27840ee9fff..ca708ffa657e 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -426,24 +426,31 @@ create_from_installed(const char *pkg, const char *suf) snprintf(log_dir, sizeof(log_dir), "%s/%s", LOG_DIR, InstalledPkg); if (!fexists(log_dir)) { warnx("can't find package '%s' installed!", InstalledPkg); - return 1; + return FALSE; } getcwd(homedir, sizeof(homedir)); if (chdir(log_dir) == FAIL) { warnx("can't change directory to '%s'!", log_dir); - return 1; + return FALSE; } /* Suck in the contents list */ plist.head = plist.tail = NULL; fp = fopen(CONTENTS_FNAME, "r"); if (!fp) { warnx("unable to open %s file", CONTENTS_FNAME); - return 1; + return FALSE; } - /* If we have a prefix, add it now */ read_plist(&plist, fp); fclose(fp); + Install = isfile(INSTALL_FNAME) ? INSTALL_FNAME : NULL; + PostInstall = isfile(POST_INSTALL_FNAME) ? POST_INSTALL_FNAME : NULL; + DeInstall = isfile(DEINSTALL_FNAME) ? DEINSTALL_FNAME : NULL; + PostDeInstall = isfile(POST_DEINSTALL_FNAME) ? POST_DEINSTALL_FNAME : NULL; + Require = isfile(REQUIRE_FNAME) ? REQUIRE_FNAME : NULL; + Display = isfile(DISPLAY_FNAME) ? DISPLAY_FNAME : NULL; + Mtree =isfile(MTREE_FNAME) ? MTREE_FNAME : NULL; + make_dist(homedir, pkg, suf, &plist); free_plist(&plist);