summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
commit76b5366091f76c9bc73570149ef5055648fc2c39 (patch)
tree590d020e0f2a5bea6e09d66d951a674443b21d67 /usr.sbin/pkg_install
parent4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff)
This commit was manufactured by cvs2svn to create tagrelease/3.0.0
'RELENG_3_0_0_RELEASE'.
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/add/extract.c4
-rw-r--r--usr.sbin/pkg_install/add/main.c52
-rw-r--r--usr.sbin/pkg_install/add/perform.c48
-rw-r--r--usr.sbin/pkg_install/add/pkg_add.183
-rw-r--r--usr.sbin/pkg_install/create/create.h4
-rw-r--r--usr.sbin/pkg_install/create/main.c23
-rw-r--r--usr.sbin/pkg_install/create/perform.c40
-rw-r--r--usr.sbin/pkg_install/create/pkg_create.153
-rw-r--r--usr.sbin/pkg_install/delete/perform.c76
-rw-r--r--usr.sbin/pkg_install/delete/pkg_delete.186
-rw-r--r--usr.sbin/pkg_install/info/perform.c6
-rw-r--r--usr.sbin/pkg_install/info/pkg_info.14
-rw-r--r--usr.sbin/pkg_install/lib/file.c6
-rw-r--r--usr.sbin/pkg_install/lib/lib.h4
14 files changed, 69 insertions, 420 deletions
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index ac8d4bffbb9f..0522f2b9910d 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: extract.c,v 1.22 1998/10/12 20:01:48 jkh Exp $";
+ "$Id: extract.c,v 1.21 1998/09/11 07:26:54 jkh Exp $";
#endif
/*
@@ -34,7 +34,7 @@ static const char rcsid[] =
#define PUSHOUT(todir) /* push out string */ \
if (where_count > sizeof(STARTSTRING)-1) { \
- strcat(where_args, "|tar --unlink -xf - -C "); \
+ strcat(where_args, "|tar xf - -C "); \
strcat(where_args, todir); \
if (system(where_args)) { \
cleanup(0); \
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index f64ca526d2dc..4e4fab296bdf 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.19 1999/01/17 01:22:54 billf Exp $";
+ "$Id: main.c,v 1.17 1998/09/08 10:42:19 jkh Exp $";
#endif
/*
@@ -26,16 +26,14 @@ static const char rcsid[] =
#include <err.h>
#include <sys/param.h>
-#include <objformat.h>
#include "lib.h"
#include "add.h"
-static char Options[] = "hvIRfnrp:SMt:";
+static char Options[] = "hvIRfnp:SMt:";
char *Prefix = NULL;
Boolean NoInstall = FALSE;
Boolean NoRecord = FALSE;
-Boolean Remote = FALSE;
char *Mode = NULL;
char *Owner = NULL;
@@ -49,9 +47,6 @@ add_mode_t AddMode = NORMAL;
char pkgnames[MAX_PKGS][MAXPATHLEN];
char *pkgs[MAX_PKGS];
-static char *getpackagesite(char *);
-int getosreldate(void);
-
static void usage __P((void));
int
@@ -61,10 +56,6 @@ main(int argc, char **argv)
char **start;
char *cp;
- char *remotepkg = NULL, *ptr;
- static char binformat[1024];
- static char packageroot[MAXPATHLEN] = "ftp://ftp.FreeBSD.org/pub/FreeBSD/";
-
start = argv;
while ((ch = getopt(argc, argv, Options)) != -1) {
switch(ch) {
@@ -93,10 +84,6 @@ main(int argc, char **argv)
Verbose = TRUE;
break;
- case 'r':
- Remote = TRUE;
- break;
-
case 't':
strcpy(FirstPen, optarg);
break;
@@ -129,24 +116,10 @@ main(int argc, char **argv)
/* Get all the remaining package names, if any */
for (ch = 0; *argv; ch++, argv++) {
- if (Remote) {
- if (getenv("PACKAGESITE") == NULL) {
- getobjformat(binformat, sizeof(binformat), &argc, argv);
- strcat(packageroot, getpackagesite(binformat));
- }
- else
- strcpy(packageroot, (getenv("PACKAGESITE")));
- remotepkg = strcat(packageroot, *argv);
- if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' &&
- ptr[2] == 'g' && ptr[3] == 'z' && !ptr[4]))
- strcat(remotepkg, ".tgz");
- }
if (!strcmp(*argv, "-")) /* stdin? */
pkgs[ch] = "-";
else if (isURL(*argv)) /* preserve URLs */
pkgs[ch] = strcpy(pkgnames[ch], *argv);
- else if ((Remote) && isURL(remotepkg))
- pkgs[ch] = strcpy(pkgnames[ch], remotepkg);
else { /* expand all pathnames to fullnames */
if (fexists(*argv)) /* refers to a file directly */
pkgs[ch] = realpath(*argv, pkgnames[ch]);
@@ -183,30 +156,11 @@ main(int argc, char **argv)
return 0;
}
-static char *
-getpackagesite(char binform[1024])
-{
- int reldate;
-
- reldate = getosreldate();
-
- if (reldate == 300005)
- return "packages-3.0/Latest/";
- else if (30004 > reldate && reldate >= 300000)
- return "packages-current-aout/Latest/" ;
- else if (30004 < reldate)
- return !strcmp(binform, "elf") ? "packages-current/Latest/" :
- "packages-current-aout/Latest";
-
- return(0);
-
-}
-
static void
usage()
{
fprintf(stderr, "%s\n%s\n",
- "usage: pkg_add [-vInrfRMS] [-t template] [-p prefix]",
+ "usage: pkg_add [-vInfRMS] [-t template] [-p prefix]",
" pkg-name [pkg-name ...]");
exit(1);
}
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index 3b5df6112c4d..f7cd122c9991 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: perform.c,v 1.53 1998/09/11 07:26:54 jkh Exp $";
+ "$Id: perform.c,v 1.52 1998/09/08 03:02:45 jkh Exp $";
#endif
/*
@@ -72,11 +72,6 @@ pkg_do(char *pkg)
PackingList p;
struct stat sb;
int inPlace;
- /* support for separate pre/post install scripts */
- int new_m = 0;
- char pre_script[FILENAME_MAX] = INSTALL_FNAME;
- char post_script[FILENAME_MAX];
- char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX];
code = 0;
zapLogDir = 0;
@@ -323,35 +318,17 @@ pkg_do(char *pkg)
}
}
- /* Test whether to use the old method of passing tokens to installation
- * scripts, and set appropriate variables..
- */
-
- if (fexists(POST_INSTALL_FNAME)) {
- new_m = 1;
- sprintf(post_script, "%s", POST_INSTALL_FNAME);
- sprintf(pre_arg, "");
- sprintf(post_arg, "");
- } else {
- if (fexists(INSTALL_FNAME)) {
- sprintf(post_script, "%s", INSTALL_FNAME);
- sprintf(pre_arg, "PRE-INSTALL");
- sprintf(post_arg, "POST-INSTALL");
- }
- }
-
/* If we're really installing, and have an installation file, run it */
- if (!NoInstall && fexists(pre_script)) {
- vsystem("chmod +x %s", pre_script); /* make sure */
+ if (!NoInstall && fexists(INSTALL_FNAME)) {
+ vsystem("chmod +x %s", INSTALL_FNAME); /* make sure */
if (Verbose)
- printf("Running pre-install for %s..\n", PkgName);
- if (!Fake && vsystem("./%s %s %s", pre_script, PkgName, pre_arg)) {
+ printf("Running install with PRE-INSTALL for %s..\n", PkgName);
+ if (!Fake && vsystem("./%s %s PRE-INSTALL", INSTALL_FNAME, PkgName)) {
warnx("install script returned error status");
- unlink(pre_script);
+ unlink(INSTALL_FNAME);
code = 1;
goto success; /* nothing to uninstall yet */
}
- if (new_m) unlink(pre_script);
}
/* Now finally extract the entire show if we're not going direct */
@@ -372,17 +349,16 @@ pkg_do(char *pkg)
}
/* Run the installation script one last time? */
- if (!NoInstall && fexists(post_script)) {
- vsystem("chmod +x %s", post_script); /* make sure */
+ if (!NoInstall && fexists(INSTALL_FNAME)) {
if (Verbose)
- printf("Running post-install for %s..\n", PkgName);
- if (!Fake && vsystem("./%s %s %s", post_script, PkgName, post_arg)) {
+ printf("Running install with POST-INSTALL for %s..\n", PkgName);
+ if (!Fake && vsystem("./%s %s POST-INSTALL", INSTALL_FNAME, PkgName)) {
warnx("install script returned error status");
- unlink(post_script);
+ unlink(INSTALL_FNAME);
code = 1;
goto fail;
}
- unlink(post_script);
+ unlink(INSTALL_FNAME);
}
/* Time to record the deed? */
@@ -413,8 +389,6 @@ pkg_do(char *pkg)
vsystem("chmod a+rx %s", LogDir);
if (fexists(DEINSTALL_FNAME))
move_file(".", DEINSTALL_FNAME, LogDir);
- if (fexists(POST_DEINSTALL_FNAME))
- move_file(".", POST_DEINSTALL_FNAME, LogDir);
if (fexists(REQUIRE_FNAME))
move_file(".", REQUIRE_FNAME, LogDir);
sprintf(contents, "%s/%s", LogDir, CONTENTS_FNAME);
diff --git a/usr.sbin/pkg_install/add/pkg_add.1 b/usr.sbin/pkg_install/add/pkg_add.1
index e4f2b6d11479..9740467f961e 100644
--- a/usr.sbin/pkg_install/add/pkg_add.1
+++ b/usr.sbin/pkg_install/add/pkg_add.1
@@ -15,7 +15,7 @@
.\"
.\"
.\" @(#)pkg_add.1
-.\" $Id: pkg_add.1,v 1.28 1999/01/17 01:22:55 billf Exp $
+.\" $Id$
.\"
.Dd November 25, 1994
.Dt pkg_add 1
@@ -25,7 +25,7 @@
.Nd a utility for installing software package distributions
.Sh SYNOPSIS
.Nm
-.Op Fl vInfrRMS
+.Op Fl vInfRMS
.Op Fl t Ar template
.Op Fl p Ar prefix
.Ar pkg-name [pkg-name ...]
@@ -48,10 +48,10 @@ attacks from miscreants who create dangerous package files.
You are advised to verify the competence and identity of those who
provide installable package files. For extra protection, use the
.Fl M
-flag to extract the package file, and inspect its contents and scripts to
-insure it poses no danger to your system's integrity. Pay particular
-attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL,
-+REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for
+flag to extract the package file, and inspect its contents and scripts
+to insure it poses no danger to your system's integrity. Pay particular
+attention to any +INSTALL, +DEINSTALL, +REQUIRE or +MTREE_DIRS files,
+and inspect the +CONTENTS file for
.Cm @cwd ,
.Cm @mode
(check for setuid),
@@ -78,8 +78,7 @@ will search them in each directory named by
.It Fl v
Turn on verbose output.
.It Fl I
-If a installation scripts (pre-install or post-install) exist for a given
-package, do not execute them.
+If an installation script exists for a given package, do not execute it.
.It Fl n
Don't actually install a package, just report the steps that
would be taken if it was.
@@ -87,9 +86,6 @@ would be taken if it was.
Do not record the installation of a package. This means
that you cannot deinstall it later, so only use this option if
you know what you are doing!
-.It Fl r
-Use the remote fetching feature. This will determine the appropriate
-objformat and release and then fetch and install the package.
.It Fl f
Force installation to proceed even if prerequisite packages are not
installed or the requirements script fails. Although
@@ -201,7 +197,7 @@ passive mode
.Ef
ftp.
.Sh TECHNICAL DETAILS
-.Nm pkg_add
+.Nm Pkg_add
is fairly simple. It extracts each package's "packing list"
into a special staging directory, parses it,
and then runs through the following sequence to fully extract the contents:
@@ -248,32 +244,18 @@ is the name of the package in question and the
keyword denotes this as an installation requirements check (useful if
you want to have one script serving multiple functions).
.It
-If a
-.Ar pre-install
-script exists for the package, it is then executed with the following
-arguments:
+If an
+.Ar install
+script exists for the package, it is then executed with the following arguments:
.Bd -filled -offset indent -compact
-.Cm script
.Ar pkg-name
-.Ar PRE-INSTALL
+.Ar PRE-INSTALL
.Ed
-
where
.Ar pkg-name
is the name of the package in question and
.Ar PRE-INSTALL
is a keyword denoting this as the preinstallation phase.
-
-.Cm Note:
-The
-.Ar PRE-INSTALL
-keyword will not appear if separate scripts for pre-install and post-install
-are given during package creation time (using the
-.Cm Fl i
-and
-.Cm Fl I
-flags to
-.Xr pkg_create 1 ).
.It
If
.Cm @option extract-in-place
@@ -307,39 +289,17 @@ flag was specified, the name of the first directory named by a
.Cm @cwd
directive within this package.
.It
-If a
-.Ar post-install
+If an
+.Ar install
script exists for the package, it is then executed as
.Bd -filled -offset indent -compact
.Cm script
.Ar pkg-name
.Ar POST-INSTALL
.Ed
-where
-.Ar pkg-name
-is the name of the package in question and
-.Ar POST-INSTALL
-is a keyword denoting this as the post-installation phase.
-
-.Cm Note:
-The
-.Ar POST-INSTALL
-keyword will not appear if separate scripts for pre-install and post-install
-are given during package creation time (using the
-.Cm Fl i
-and
-.Cm Fl I
-flags to
-.Xr pkg_create 1 ).
-
-Reasoning behind passing keywords such as
-.Ar POST-INSTALL
-and
-.Ar PRE-INSTALL
-is that this allows you to write a single
+This all allows you to write a single
.Ar install
-script that does both ``before and after'' actions. But, separating the
-functionality is more advantageous and easier from a maintainence viewpoint.
+script that does both ``before and after'' actions.
.It
After installation is complete, a copy of the packing list,
.Ar deinstall
@@ -396,17 +356,6 @@ will use the first of
or
.Pa /usr/tmp
with sufficient space.
-.Pp
-The environment variable
-.Ev PACKAGESITE
-specifies an alternate location for
-.Nm
-to fetch from. This variable subverts the automatic directory logic
-that
-.Nm
-uses when the
-.Fl r
-option is invoked.
.Sh FILES
.Bl -tag -width /var/db/pkg -compact
.It Pa /var/tmp
diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h
index 45b90b10ed17..eab822a371e9 100644
--- a/usr.sbin/pkg_install/create/create.h
+++ b/usr.sbin/pkg_install/create/create.h
@@ -1,4 +1,4 @@
-/* $Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp $ */
+/* $Id: create.h,v 1.12 1997/06/06 12:19:11 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -28,9 +28,7 @@ extern char *Comment;
extern char *Desc;
extern char *Display;
extern char *Install;
-extern char *PostInstall;
extern char *DeInstall;
-extern char *PostDeInstall;
extern char *Contents;
extern char *Require;
extern char *SrcDir;
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 55810c2b2531..38fff8a66b0f 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp $";
+ "$Id: main.c,v 1.16 1997/06/06 12:19:11 jkh Exp $";
#endif
/*
@@ -18,7 +18,7 @@ static const char rcsid[] =
#include "lib.h"
#include "create.h"
-static char Options[] = "YNOhvf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:";
+static char Options[] = "YNOhvf:p:P:c:d:i:k:r:t:X:D:m:s:";
char *Prefix = NULL;
char *Comment = NULL;
@@ -26,9 +26,7 @@ char *Desc = NULL;
char *SrcDir = NULL;
char *Display = NULL;
char *Install = NULL;
-char *PostInstall = NULL;
char *DeInstall = NULL;
-char *PostDeInstall = NULL;
char *Contents = NULL;
char *Require = NULL;
char *ExcludeFrom = NULL;
@@ -89,18 +87,10 @@ main(int argc, char **argv)
Install = optarg;
break;
- case 'I':
- PostInstall = optarg;
- break;
-
case 'k':
DeInstall = optarg;
break;
- case 'K':
- PostDeInstall = optarg;
- break;
-
case 'r':
Require = optarg;
break;
@@ -161,11 +151,10 @@ main(int argc, char **argv)
static void
usage()
{
- fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
+ fprintf(stderr, "%s\n%s\n%s\n%s\n",
"usage: pkg_create [-YNOhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
-" [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ",
-" [-t template] [-X excludefile] [-D displayfile] ",
-" [-m mtreefile] -c comment -d description -f packlist ",
-" pkg-name");
+" [-k dscript] [-r rscript] [-t template] [-X excludefile]",
+" [-D displayfile] [-m mtreefile] -c comment -d description",
+" -f packlist pkg-name");
exit(1);
}
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 5e7443d9a396..6d13be57f7eb 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: perform.c,v 1.46 1998/12/05 06:28:58 asami Exp $";
+ "$Id: perform.c,v 1.44 1998/09/08 10:42:24 jkh Exp $";
#endif
/*
@@ -45,8 +45,6 @@ pkg_perform(char **pkgs)
FILE *pkg_in, *fp;
Package plist;
int len;
- char *suf;
- int compress;
/* Preliminary setup */
sanity_check();
@@ -65,24 +63,10 @@ pkg_perform(char **pkgs)
}
plist.head = plist.tail = NULL;
- /* chop suffix off if already specified, remembering if we want to compress */
+ /* chop suffix off if already specified */
len = strlen(pkg);
- if (len > 4)
- if (!strcmp(&pkg[len - 4], ".tgz")) {
- compress = TRUE;
- pkg[len - 4] = '\0';
- }
- else if (!strcmp(&pkg[len - 4], ".tar")) {
- compress = FALSE;
- pkg[len - 4] = '\0';
- }
- else
- /* default is to compress packages */
- compress = TRUE;
- if (compress)
- suf = "tgz";
- else
- suf = "tar";
+ if (len > 4 && !strcmp(&pkg[len - 4], ".tgz"))
+ pkg[len - 4] = '\0';
/* Stick the dependencies, if any, at the top */
if (Pkgdeps) {
@@ -156,21 +140,11 @@ pkg_perform(char **pkgs)
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, INSTALL_FNAME);
}
- if (PostInstall) {
- copy_file(home, PostInstall, POST_INSTALL_FNAME);
- add_plist(&plist, PLIST_IGNORE, NULL);
- add_plist(&plist, PLIST_FILE, POST_INSTALL_FNAME);
- }
if (DeInstall) {
copy_file(home, DeInstall, DEINSTALL_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, DEINSTALL_FNAME);
}
- if (PostDeInstall) {
- copy_file(home, PostDeInstall, POST_DEINSTALL_FNAME);
- add_plist(&plist, PLIST_IGNORE, NULL);
- add_plist(&plist, PLIST_FILE, POST_DEINSTALL_FNAME);
- }
if (Require) {
copy_file(home, Require, REQUIRE_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
@@ -202,7 +176,7 @@ pkg_perform(char **pkgs)
}
/* And stick it into a tar ball */
- make_dist(home, pkg, suf, &plist);
+ make_dist(home, pkg, "tgz", &plist);
/* Cleanup */
free(Comment);
@@ -280,12 +254,8 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
if (Install)
fprintf(totar, "%s\n", INSTALL_FNAME);
- if (PostInstall)
- fprintf(totar, "%s\n", POST_INSTALL_FNAME);
if (DeInstall)
fprintf(totar, "%s\n", DEINSTALL_FNAME);
- if (PostDeInstall)
- fprintf(totar, "%s\n", POST_DEINSTALL_FNAME);
if (Require)
fprintf(totar, "%s\n", REQUIRE_FNAME);
if (Display)
diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1
index 8596261907b3..eaec8fb1143a 100644
--- a/usr.sbin/pkg_install/create/pkg_create.1
+++ b/usr.sbin/pkg_install/create/pkg_create.1
@@ -15,7 +15,7 @@
.\"
.\"
.\" @(#)pkg_create.1
-.\" $Id: pkg_create.1,v 1.26 1998/06/26 07:15:37 jkoshy Exp $
+.\" $Id: pkg_create.1,v 1.25 1998/05/24 03:11:17 steve Exp $
.\"
.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords,
.\" added dependency tracking, etc.
@@ -36,9 +36,7 @@
.Op Fl p Ar prefix
.Op Fl f Ar contents
.Op Fl i Ar iscript
-.Op Fl I Ar piscript
.Op Fl k Ar dscript
-.Op Fl K Ar pdscript
.Op Fl r Ar rscript
.Op Fl s Ar srcdir
.Op Fl t Ar template
@@ -104,28 +102,9 @@ are dumped, rather than the links themselves.
.It Fl i Ar iscript
Set
.Ar iscript
-to be the pre-install procedure for the package. This can be any executable
-program (or shell script). It will be invoked automatically when the
-package is later installed. It will be passed the package's name as the
-first argument.
-
-.Cm Note:
-if the
-.Cm Fl I
-option is not given, this script will serve as both the pre-install and the
-post-install script for the package, differentiating between the
-functionality by passing the keywords
-.Ar PRE-INSTALL
-and
-.Ar POST-INSTALL
-respectively, along with the package's name.
-.It Fl I Ar piscript
-Set
-.Ar piscript
-to be the post-install procedure for the package. This can be any
+to be the install procedure for the package. This can be any
executable program (or shell script). It will be invoked automatically
-when the package is later installed. It will be passed the package's name as
-the first argument.
+when the package is later installed.
.It Fl P Ar pkgs
Set the initial package dependency list to
.Ar pkgs .
@@ -141,29 +120,9 @@ the package.
.It Fl k Ar dscript
Set
.Ar dscript
-to be the de-install procedure for the package. This can be any executable
-program (or shell script). It will be invoked automatically when the
-package is later (if ever) de-installed. It will be passed the package's
-name as the first argument.
-
-.Cm Note:
-if the
-.Cm Fl K
-option is not given, this script will serve as both the de-install and the
-post-deinstall script for the package, differentiating between the
-functionality by passing the keywords
-.Ar DEINSTALL
-and
-.Ar POST-DEINSTALL
-respectively, along with the package's name.
-.It Fl K Ar pdscript
-Set
-.Ar pdscript
-to be the post-deinstall procedure for the package. This can be any
-executable program (or shell script). It will be invoked automatically when
-the package is later de-installed. It will be passed the package's name as
-the first argument.
-
+to be the de-install procedure for the package. This can be any
+executable program (or shell script). It will be invoked automatically
+when the package is later (if ever) de-installed.
.It Fl r Ar rscript
Set
.Ar rscript
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c
index dc85e02f341b..97b9528b5402 100644
--- a/usr.sbin/pkg_install/delete/perform.c
+++ b/usr.sbin/pkg_install/delete/perform.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: perform.c,v 1.17 1998/11/11 06:09:04 jkh Exp $";
+ "$Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp $";
#endif
/*
@@ -53,17 +53,6 @@ pkg_do(char *pkg)
char home[FILENAME_MAX];
PackingList p;
char *tmp;
- int len;
- /* support for separate pre/post install scripts */
- int new_m = 0;
- char pre_script[FILENAME_MAX] = DEINSTALL_FNAME;
- char post_script[FILENAME_MAX];
- char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX];
-
- if (!pkg || !(len = strlen(pkg)))
- return 1;
- if (pkg[len - 1] == '/')
- pkg[len - 1] = '\0';
/* Reset some state */
if (Plist.head)
@@ -71,22 +60,18 @@ pkg_do(char *pkg)
sprintf(LogDir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR,
pkg);
-
if (!fexists(LogDir)) {
warnx("no such package '%s' installed", pkg);
return 1;
}
-
if (!getcwd(home, FILENAME_MAX)) {
cleanup(0);
errx(2, "unable to get current working directory!");
}
-
if (chdir(LogDir) == FAIL) {
warnx("unable to change directory to %s! deinstall failed", LogDir);
return 1;
}
-
if (!isemptyfile(REQUIRED_BY_FNAME)) {
char buf[512];
warnx("package `%s' is required by these other packages\n"
@@ -102,29 +87,23 @@ pkg_do(char *pkg)
if (!Force)
return 1;
}
-
sanity_check(LogDir);
cfile = fopen(CONTENTS_FNAME, "r");
-
if (!cfile) {
warnx("unable to open '%s' file", CONTENTS_FNAME);
return 1;
}
-
/* If we have a prefix, add it now */
if (Prefix)
add_plist(&Plist, PLIST_CWD, Prefix);
read_plist(&Plist, cfile);
fclose(cfile);
p = find_plist(&Plist, PLIST_CWD);
-
if (!p) {
warnx("package '%s' doesn't have a prefix", pkg);
return 1;
}
-
setenv(PKG_PREFIX_VNAME, p->name, 1);
-
if (fexists(REQUIRE_FNAME)) {
if (Verbose)
printf("Executing 'require' script.\n");
@@ -136,81 +115,34 @@ pkg_do(char *pkg)
return 1;
}
}
-
- /* Test whether to use the old method of passing tokens to deinstallation
- * scripts, and set appropriate variables..
- */
-
- if (fexists(POST_DEINSTALL_FNAME)) {
- new_m = 1;
- sprintf(post_script, "%s", POST_DEINSTALL_FNAME);
- sprintf(pre_arg, "");
- sprintf(post_arg, "");
- } else {
- if (fexists(DEINSTALL_FNAME)) {
- sprintf(post_script, "%s", DEINSTALL_FNAME);
- sprintf(pre_arg, "DEINSTALL");
- sprintf(post_arg, "POST-DEINSTALL");
- }
- }
-
- if (!NoDeInstall && fexists(pre_script)) {
+ if (!NoDeInstall && fexists(DEINSTALL_FNAME)) {
if (Fake)
printf("Would execute de-install script at this point.\n");
else {
- vsystem("chmod +x %s", pre_script); /* make sure */
- if (vsystem("./%s %s %s", pre_script, pkg, pre_arg)) {
+ vsystem("chmod +x %s", DEINSTALL_FNAME); /* make sure */
+ if (vsystem("./%s %s DEINSTALL", DEINSTALL_FNAME, pkg)) {
warnx("deinstall script returned error status");
if (!Force)
return 1;
}
}
}
-
if (chdir(home) == FAIL) {
cleanup(0);
errx(2, "Toto! This doesn't look like Kansas anymore!");
}
-
if (!Fake) {
/* Some packages aren't packed right, so we need to just ignore delete_package()'s status. Ugh! :-( */
if (delete_package(FALSE, CleanDirs, &Plist) == FAIL)
warnx(
"couldn't entirely delete package (perhaps the packing list is\n"
"incorrectly specified?)");
- }
-
- if (chdir(LogDir) == FAIL) {
- warnx("unable to change directory to %s! deinstall failed", LogDir);
- return 1;
- }
-
- if (!NoDeInstall && fexists(post_script)) {
- if (Fake)
- printf("Would execute post-deinstall script at this point.\n");
- else {
- vsystem("chmod +x %s", post_script); /* make sure */
- if (vsystem("./%s %s %s", post_script, pkg, post_arg)) {
- warnx("post-deinstall script returned error status");
- if (!Force)
- return 1;
- }
- }
- }
-
- if (chdir(home) == FAIL) {
- cleanup(0);
- errx(2, "Toto! This doesn't look like Kansas anymore!");
- }
-
- if (!Fake) {
if (vsystem("%s -r %s", REMOVE_CMD, LogDir)) {
warnx("couldn't remove log entry in %s, deinstall failed", LogDir);
if (!Force)
return 1;
}
}
-
for (p = Plist.head; p ; p = p->next) {
if (p->type != PLIST_PKGDEP)
continue;
diff --git a/usr.sbin/pkg_install/delete/pkg_delete.1 b/usr.sbin/pkg_install/delete/pkg_delete.1
index 9941afe1ce3d..31888e7338c9 100644
--- a/usr.sbin/pkg_install/delete/pkg_delete.1
+++ b/usr.sbin/pkg_install/delete/pkg_delete.1
@@ -47,9 +47,9 @@ You are advised to verify the competence and identity of those who
provide installable package files. For extra protection, examine all
the package control files in the package record directory (
.Pa /var/db/pkg/<pkg-name>/ ).
-Pay particular attention to any +INSTALL, +POST-INSTALL, +DEINSTALL,
-+POST-DEINSTALL, +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS
-file for
+Pay particular
+attention to any +INSTALL, +DEINSTALL, +REQUIRE or +MTREE_DIRS files,
+and inspect the +CONTENTS file for
.Cm @cwd ,
.Cm @mode
(check for setuid),
@@ -97,15 +97,10 @@ deinstall or require script fails.
.Pp
.Sh TECHNICAL DETAILS
-.Nm pkg_delete
+.Nm Pkg_delete
does pretty much what it says. It examines installed package records in
.Pa /var/db/pkg/<pkg-name> ,
deletes the package contents, and finally removes the package records.
-If the environment variable
-.Ev PKG_DBDIR
-is set, this overrides the
-.Pa /var/db/pkg/
-path shown above.
.Pp
If a package is required by other installed packages,
.Nm
@@ -145,71 +140,14 @@ The
.Nm deinstall
script is called as:
.Bd -filled -offset indent -compact
-.Cm script
+.Cm deinstall
.Ar <pkg-name>
.Ar DEINSTALL
.Ed
-where
-.Ar pkg-name
-is the name of the package in question and
-.Ar DEINSTALL
-is a keyword denoting this as the pre-deinstallation phase.
-
-.Cm Note:
-The
+Passing the keyword
.Ar DEINSTALL
-keyword will not appear if separate scripts for deinstall and post-deinstall
-are given during package creation time (using the
-.Cm Fl k
-and
-.Cm Fl K
-flags to
-.Xr pkg_create 1 ).
-.Pp
-If a
-.Cm post-deinstall
-script exists for the package, it is executed
-.Cm after
-all files are removed. It is this script's responsibility to clean up any
-additional messy details around the package's installation, and leave the
-system (hopefully) in the same state that it was prior to the installation
-of the package.
-
-The
-.Nm post-deinstall
-script is called as:
-.Bd -filled -offset indent -compact
-.Cm script
-.Ar <pkg-name>
-.Ar POST-DEINSTALL
-.Ed
-where
-.Ar pkg-name
-is the name of the package in question and
-.Ar POST-DEINSTALL
-is a keyword denoting this as the post-deinstallation phase.
-
-.Cm Note:
-The
-.Ar POST-DEINSTALL
-keyword will not appear if separate scripts for deinstall and post-deinstall
-are given during package creation time (using the
-.Cm Fl k
-and
-.Cm Fl K
-flags to
-.Xr pkg_create 1 ).
-
-Reasoning behind passing keywords such as
-.Ar DEINSTALL
-and
-.Ar POST-DEINSTALL
-is that it lets you potentially write only one program/script that handles
-all aspects of installation and deletion.
-
-But experience has proved that this is a lot more difficult to maintain and
-is not as advantageous as having separate scripts that handle each aspect of
-installation and deinstallation.
+lets you potentially write only one program/script that handles all
+aspects of installation and deletion.
.Pp
All scripts are called with the environment variable
.Ev PKG_PREFIX
@@ -223,14 +161,6 @@ option when running
.Nm
or
.Cm pkg_add .
-.Sh ENVIRONMENT
-The environment variable
-.Ev PKG_DBDIR
-specifies an alternative location for the installed package database.
-.Sh FILES
-.Bl -tag -width /var/db/pkg -compact
-.It Pa /var/db/pkg
-Default location of the installed package database.
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_create 1 ,
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index 84a3b9a5253f..c409fe744c1d 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: perform.c,v 1.25 1998/09/11 07:26:58 jkh Exp $";
+ "$Id: perform.c,v 1.24 1998/02/16 17:16:38 jkh Exp $";
#endif
/*
@@ -179,12 +179,8 @@ pkg_do(char *pkg)
show_plist("Packing list:\n", &plist, (plist_t)-1);
if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME))
show_file("Install script:\n", INSTALL_FNAME);
- if ((Flags & SHOW_INSTALL) && fexists(POST_INSTALL_FNAME))
- show_file("Post-Install script:\n", POST_INSTALL_FNAME);
if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME))
show_file("De-Install script:\n", DEINSTALL_FNAME);
- if ((Flags & SHOW_DEINSTALL) && fexists(POST_DEINSTALL_FNAME))
- show_file("Post-DeInstall script:\n", POST_DEINSTALL_FNAME);
if ((Flags & SHOW_MTREE) && fexists(MTREE_FNAME))
show_file("mtree file:\n", MTREE_FNAME);
if (Flags & SHOW_PREFIX)
diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1
index 9105cca41d6d..3c3f5c1228b3 100644
--- a/usr.sbin/pkg_install/info/pkg_info.1
+++ b/usr.sbin/pkg_install/info/pkg_info.1
@@ -15,7 +15,7 @@
.\"
.\"
.\" @(#)pkg_info.1
-.\" $Id: pkg_info.1,v 1.18 1998/07/14 08:28:15 jkoshy Exp $
+.\" $Id$
.\"
.Dd November 25, 1994
.Dt pkg_info 1
@@ -134,7 +134,7 @@ If this variable is not set,
is used. If both are unset, the builtin defaults are used.
.Pp
.Ev PKG_DBDIR
-specifies an alternative location for the installed package database.
+names the location of the installed package database.
.Sh FILES
.Bl -tag -width /var/db/pkg -compact
.It Pa /var/tmp
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 9aed73cf3999..c12b35ca03dd 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: file.c,v 1.34 1998/10/14 18:52:04 jkh Exp $";
+ "$Id: file.c,v 1.33 1998/10/09 00:01:16 jkh Exp $";
#endif
/*
@@ -487,8 +487,8 @@ unpack(char *pkg, char *flist)
}
}
else
- strcpy(args, "-z");
- strcat(args, " -xpf");
+ strcpy(args, "z");
+ strcat(args, "xpf");
if (vsystem("tar %s %s %s", args, pkg, flist ? flist : "")) {
warnx("tar extract of %s failed!", pkg);
return 1;
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h
index 595b2a1c2f7f..a0de2a459bc9 100644
--- a/usr.sbin/pkg_install/lib/lib.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -1,4 +1,4 @@
-/* $Id: lib.h,v 1.26 1998/02/16 17:16:47 jkh Exp $ */
+/* $Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -66,9 +66,7 @@
#define COMMENT_FNAME "+COMMENT"
#define DESC_FNAME "+DESC"
#define INSTALL_FNAME "+INSTALL"
-#define POST_INSTALL_FNAME "+POST-INSTALL"
#define DEINSTALL_FNAME "+DEINSTALL"
-#define POST_DEINSTALL_FNAME "+POST-DEINSTALL"
#define REQUIRE_FNAME "+REQUIRE"
#define REQUIRED_BY_FNAME "+REQUIRED_BY"
#define DISPLAY_FNAME "+DISPLAY"