Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pkgviews]: src/usr.sbin/pkg_install Sync to HEAD.
details: https://anonhg.NetBSD.org/src/rev/0a9ae9fc3b7c
branches: pkgviews
changeset: 534273:0a9ae9fc3b7c
user: jlam <jlam%NetBSD.org@localhost>
date: Tue Aug 26 22:32:12 2003 +0000
description:
Sync to HEAD.
diffstat:
usr.sbin/pkg_install/add/futil.c | 32 ++++---
usr.sbin/pkg_install/add/perform.c | 25 ++---
usr.sbin/pkg_install/add/pkg_add.1 | 8 +-
usr.sbin/pkg_install/create/perform.c | 7 +-
usr.sbin/pkg_install/lib/Makefile | 4 +-
usr.sbin/pkg_install/lib/fexec.c | 141 ++++++++++++++++++++++++++++++++++
usr.sbin/pkg_install/lib/lib.h | 4 +-
usr.sbin/pkg_install/lib/pen.c | 10 +-
8 files changed, 187 insertions(+), 44 deletions(-)
diffs (truncated from 440 to 300 lines):
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/add/futil.c
--- a/usr.sbin/pkg_install/add/futil.c Tue Aug 26 22:13:04 2003 +0000
+++ b/usr.sbin/pkg_install/add/futil.c Tue Aug 26 22:32:12 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: futil.c,v 1.8.12.1 2003/07/13 09:45:20 jlam Exp $ */
+/* $NetBSD: futil.c,v 1.8.12.2 2003/08/26 22:32:12 jlam Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: futil.c,v 1.7 1997/10/08 07:45:39 charnier Exp";
#else
-__RCSID("$NetBSD: futil.c,v 1.8.12.1 2003/07/13 09:45:20 jlam Exp $");
+__RCSID("$NetBSD: futil.c,v 1.8.12.2 2003/08/26 22:32:12 jlam Exp $");
#endif
#endif
@@ -53,7 +53,7 @@
if (!(isdir(dir) || islinktodir(dir)))
return FAIL;
} else {
- if (vsystem("mkdir %s", dir))
+ if (fexec("mkdir", dir, NULL))
return FAIL;
apply_perms(NULL, dir);
}
@@ -80,19 +80,25 @@
cd_to = dir;
if (Mode)
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHMOD_CMD, Mode, arg))
- warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
- if (Owner && Group) {
- if (vsystem("cd %s && %s -R %s.%s %s", cd_to, CHOWN_CMD, Owner, Group, arg))
+ if (fcexec(cd_to, CHMOD_CMD, "-R", Mode, arg, NULL))
+ warnx("couldn't change modes of '%s' to '%s'", arg,
+ Mode);
+ if (Owner != NULL && Group != NULL) {
+ if (vsystem("cd %s && %s -R %s.%s %s", cd_to, CHOWN_CMD, Owner,
+ Group, arg))
warnx("couldn't change owner/group of '%s' to '%s.%s'",
arg, Owner, Group);
return;
}
- if (Owner) {
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHOWN_CMD, Owner, arg))
- warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
+ if (Owner != NULL) {
+ if (fcexec(cd_to, CHOWN_CMD, "-R", Owner, arg, NULL))
+ warnx("couldn't change owner of '%s' to '%s'", arg,
+ Owner);
return;
- } else if (Group)
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHGRP_CMD, Group, arg))
- warnx("couldn't change group of '%s' to '%s'", arg, Group);
+ }
+ if (Group != NULL) {
+ if (fcexec(cd_to, CHGRP_CMD, "-R", Group, arg, NULL))
+ warnx("couldn't change group of '%s' to '%s'", arg,
+ Group);
+ }
}
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c Tue Aug 26 22:13:04 2003 +0000
+++ b/usr.sbin/pkg_install/add/perform.c Tue Aug 26 22:32:12 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.70.2.7 2003/08/21 01:57:22 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.70.2.8 2003/08/26 22:32:12 jlam Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.70.2.7 2003/08/21 01:57:22 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.70.2.8 2003/08/26 22:32:12 jlam Exp $");
#endif
#endif
@@ -130,8 +130,9 @@
/* make sure dbdir actually exists! */
if (!(isdir(dbdir) || islinktodir(dbdir))) {
- if (vsystem("mkdir -p -m 755 %s", dbdir)) {
- errx(EXIT_FAILURE, "Database-dir %s cannot be generated, aborting.",
+ if (fexec("mkdir", "-m", "755", "-p", dbdir, NULL)) {
+ errx(EXIT_FAILURE,
+ "Database-dir %s cannot be generated, aborting.",
dbdir);
}
}
@@ -225,7 +226,7 @@
if (!(isdir(p->name) || islinktodir(p->name)) && !Fake) {
if (Verbose)
printf("Desired prefix of %s does not exist, creating.\n", p->name);
- (void) vsystem("mkdir -p %s", p->name);
+ (void) fexec("mkdir", "-p", p->name, NULL);
}
if (chdir(p->name) == -1) {
warn("unable to change directory to `%s'", p->name);
@@ -434,7 +435,7 @@
if (Verbose)
printf("pkg_delete '%s'\n", installed);
vsystem("%s/pkg_delete '%s'\n", BINDIR, installed);
-
+
} else {
warnx("other version '%s' already installed", installed);
@@ -453,9 +454,6 @@
continue;
if (Verbose)
printf("Package `%s' conflicts with `%s'.\n", PkgName, p->name);
-
- /* was: */
- /* if (!vsystem("%s/pkg_info -qe '%s'", BINDIR, p->name)) { */
if (findmatchingname(dbdir, p->name, note_whats_installed, installed) > 0) {
warnx("Conflicting package `%s'installed, please use\n"
"\t\"pkg_delete %s\" first to remove it!", installed, installed);
@@ -473,7 +471,6 @@
continue;
if (Verbose)
printf("Depends pre-scan: `%s' required.\n", p->name);
- /* if (vsystem("%s/pkg_info -qe '%s'", BINDIR, p->name)) { */
if (findmatchingname(dbdir, p->name, note_whats_installed, installed) <= 0) {
/*
* required pkg not found. look if it's available with a more liberal
@@ -578,7 +575,7 @@
/* Look for the requirements file */
if (fexists(REQUIRE_FNAME)) {
- vsystem("%s +x %s", CHMOD_CMD, REQUIRE_FNAME); /* be sure */
+ (void) fexec(CHMOD_CMD, "+x", REQUIRE_FNAME, NULL); /* be sure */
if (Verbose)
printf("Running requirements file first for %s.\n", PkgName);
if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, PkgName)) {
@@ -593,7 +590,7 @@
/* If we're really installing, and have an installation file, run it */
if (!NoInstall && fexists(INSTALL_FNAME)) {
- vsystem("%s +x %s", CHMOD_CMD, INSTALL_FNAME); /* make sure */
+ (void) fexec(CHMOD_CMD, "+x", INSTALL_FNAME, NULL); /* make sure */
if (Verbose)
printf("Running install with PRE-INSTALL for %s.\n", PkgName);
if (!Fake && vsystem("./%s %s PRE-INSTALL", INSTALL_FNAME, PkgName)) {
@@ -658,7 +655,7 @@
goto success; /* close enough for government work */
}
/* Make sure pkg_info can read the entry */
- vsystem("%s a+rx %s", CHMOD_CMD, LogDir);
+ (void) fexec(CHMOD_CMD, "a+rx", LogDir, NULL);
if (fexists(INSTALL_FNAME))
move_file(".", INSTALL_FNAME, LogDir);
if (fexists(DEINSTALL_FNAME))
@@ -822,7 +819,7 @@
if (signo)
printf("Signal %d received, cleaning up.\n", signo);
if (!Fake && zapLogDir && LogDir[0])
- vsystem("%s -rf %s", REMOVE_CMD, LogDir);
+ (void) fexec(REMOVE_CMD, "-fr", LogDir, NULL);
leave_playpen(Home);
if (signo)
exit(1);
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/add/pkg_add.1
--- a/usr.sbin/pkg_install/add/pkg_add.1 Tue Aug 26 22:13:04 2003 +0000
+++ b/usr.sbin/pkg_install/add/pkg_add.1 Tue Aug 26 22:32:12 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.33.4.6 2003/08/25 20:17:08 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.33.4.7 2003/08/26 22:32:12 jlam Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -271,7 +271,7 @@
Thus you may extract files directly from their anonymous ftp or WWW
locations (e.g.
.Nm
-ftp://ftp.netbsd.org/pub/NetBSD/packages/1.5/i386/shells/bash-2.04.tgz).
+ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.5/i386/shells/bash-2.04.tgz).
Note: If you wish to use
.Bf -emphasis
passive mode
@@ -517,9 +517,9 @@
The URL can be put into an environment variable,
.Ev PKG_PATH .
.Bd -literal
-# pkg_add -v ftp://ftp.netbsd.org/pub/NetBSD/packages/1.5/i386/All/mozilla-0.8.1.tgz
+# pkg_add -v ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.5/i386/All/mozilla-0.8.1.tgz
-# export PKG_PATH=ftp://ftp.netbsd.org/pub/NetBSD/packages/1.5/i386/All
+# export PKG_PATH=ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.5/i386/All
# pkg_add -v mozilla
.Ed
.Sh SEE ALSO
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/create/perform.c
--- a/usr.sbin/pkg_install/create/perform.c Tue Aug 26 22:13:04 2003 +0000
+++ b/usr.sbin/pkg_install/create/perform.c Tue Aug 26 22:32:12 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.33.2.3 2003/07/29 01:39:12 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.33.2.4 2003/08/26 22:32:13 jlam Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.33.2.3 2003/07/29 01:39:12 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.33.2.4 2003/08/26 22:32:13 jlam Exp $");
#endif
#endif
@@ -79,9 +79,6 @@
args[nargs++] = "-"; /* Use stdin for the file. */
args[nargs] = NULL;
- if (Verbose)
- printf("Creating binary pkg '%s'\n", tball);
-
/* Set up a pipe for passing the filenames, and fork off a tar process. */
if (pipe(pipefds) == -1) {
cleanup(0);
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/lib/Makefile
--- a/usr.sbin/pkg_install/lib/Makefile Tue Aug 26 22:13:04 2003 +0000
+++ b/usr.sbin/pkg_install/lib/Makefile Tue Aug 26 22:32:12 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.18.2.1 2003/07/13 09:45:26 jlam Exp $
+# $NetBSD: Makefile,v 1.18.2.2 2003/08/26 22:32:13 jlam Exp $
# Original from FreeBSD, no rcs id.
NOLINT= # defined
@@ -8,7 +8,7 @@
LIB+= install
SRCS+= exec.c file.c ftpio.c global.c lpkg.c pen.c pkgdb.c \
- plist.c str.c version.c path.c
+ plist.c str.c version.c path.c fexec.c
# only needed during build - prevent installation of library
libinstall::
diff -r 685a2e316d02 -r 0a9ae9fc3b7c usr.sbin/pkg_install/lib/fexec.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/pkg_install/lib/fexec.c Tue Aug 26 22:32:12 2003 +0000
@@ -0,0 +1,141 @@
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matthias Scheler.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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 <sys/cdefs.h>
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "lib.h"
+
+#ifndef lint
+__RCSID("$NetBSD: fexec.c,v 1.3.2.2 2003/08/26 22:32:13 jlam Exp $");
+#endif
+
+static int vfcexec(const char *, const char *, va_list);
+
+static int
+vfcexec(const char *path, const char *arg, va_list ap)
+{
+ static unsigned int max = 4;
Home |
Main Index |
Thread Index |
Old Index