[Fpkg-cvs] CVS: freepkg/version Makefile fpkg_version.1 main.c test-pkg_version.sh
Status: Alpha
Brought to you by:
jlea
|
From: Jeremy L. <jl...@us...> - 2004-04-29 13:25:39
|
jlea 04/04/29 06:25:33
Modified: . Makefile Makefile.inc
add Makefile main.c
create Makefile main.c
delete Makefile main.c
fpkg Makefile main.c
info Makefile main.c
lib Makefile depend.c entry.c file.c lib.h manager.c
package.c show.c
Added: add fpkg_add.1
create fpkg_create.1
delete fpkg_delete.1
info fpkg_info.1
version Makefile fpkg_version.1 main.c test-pkg_version.sh
Removed: add pkg_add.1
create pkg_create.1
delete pkg_delete.1
fpkg test-pkg_version.sh
info pkg_info.1
Log:
Move over to new FreePKG/fpkg name. Cleaning and fixing.
Revision Changes Path
1.2 +2 -2 freepkg/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:05:14 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:27 -0000 1.2
@@ -1,5 +1,5 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:27 jlea Exp $
-SUBDIR=lib add create delete info fpkg
+SUBDIR=lib add create delete info version fpkg
.include <bsd.subdir.mk>
1.2 +3 -3 freepkg/Makefile.inc
Index: Makefile.inc
===================================================================
RCS file: /cvsroot/fpkg/freepkg/Makefile.inc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.inc 26 Apr 2004 00:05:14 -0000 1.1
+++ Makefile.inc 29 Apr 2004 13:25:27 -0000 1.2
@@ -1,9 +1,9 @@
-# $Id: Makefile.inc,v 1.1 2004/04/26 00:05:14 jlea Exp $
+# $Id: Makefile.inc,v 1.2 2004/04/29 13:25:27 jlea Exp $
.if exists(${.OBJDIR}/../lib)
-LIBINSTALL= ${.OBJDIR}/../lib/libinstall.a
+LIBFPKG= ${.OBJDIR}/../lib/libfpkg.a
.else
-LIBINSTALL= ${.CURDIR}/../lib/libinstall.a
+LIBDPKG= ${.CURDIR}/../lib/libfpkg.a
.endif
BINDIR?= /root/bin
1.2 +4 -4 freepkg/add/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/add/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:06:22 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:27 -0000 1.2
@@ -1,13 +1,13 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:06:22 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:27 jlea Exp $
-PROG= pkg_add
+PROG= fpkg_add
SRCS= main.c
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
WARNS?= 2
-DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD= ${LIBINSTALL} -lfetch -lmd
+DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBFPKG} -lfetch -lmd
.include <bsd.prog.mk>
1.2 +27 -15 freepkg/add/main.c
Index: main.c
===================================================================
RCS file: /cvsroot/fpkg/freepkg/add/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.c 26 Apr 2004 00:06:27 -0000 1.1
+++ main.c 29 Apr 2004 13:25:27 -0000 1.2
@@ -1,29 +1,41 @@
-#ifndef lint
-static const char rcsid[] =
- "$Id: main.c,v 1.1 2004/04/26 00:06:27 jlea Exp $";
-#endif
-
/*
- *
- * FreeBSD install - a package for the installation and maintainance
- * of non-core utilities.
+ * FreePKG - A utility for managing 3rd party software.
*
* 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.
+ * 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.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * Jordan K. Hubbard
- * 18 July 1993
+ * 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.
*
- * This is the add module.
+ * Jeremy D. Lea
+ * 22 April 2004.
*
+ * Based on pkg_install, by:
+ * Jordan K. Hubbard
+ * 18 July 1993
+ *
+ * This is the add module.
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id: main.c,v 1.2 2004/04/29 13:25:27 jlea Exp $";
+#endif
+
#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -167,7 +179,7 @@
}
while (*argv) {
if (remote)
- err += pkg_mgr_add_latest(*argv);
+ err += pkg_mgr_add(pkg_mgr_latest(*argv));
else
err += pkg_mgr_add(*argv);
argv++;
1.1 freepkg/add/fpkg_add.1
.\"
.\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities.
.\"
.\" 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.
.\"
.\" Jordan K. Hubbard
.\"
.\"
.\" @(#)pkg_add.1
.\" $FreeBSD: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.35.2.15 2003/08/11 01:13:43 kris Exp $
.\"
.Dd November 25, 1994
.Dt PKG_ADD 1
.Os
.Sh NAME
.Nm pkg_add
.Nd a utility for installing software package distributions
.Sh SYNOPSIS
.Nm
.Op Fl vInfrRMS
.Op Fl t Ar template
.Op Fl p Ar prefix
.Ar pkg-name Op Ar pkg-name ...
.Sh DESCRIPTION
The
.Nm
command is used to extract packages that have been previously created
with the
.Xr pkg_create 1
command.
.Sh WARNING
.Bf -emphasis
Since the
.Nm
command may execute scripts or programs contained within a package file,
your system may be susceptible to
.Dq Em trojan horses
or other subtle
attacks from miscreants who create dangerous package files.
.Pp
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
ensure 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
.Cm @cwd ,
.Cm @mode
(check for setuid),
.Cm @dirrm ,
.Cm @exec ,
and
.Cm @unexec
directives, and/or use the
.Xr pkg_info 1
command to examine the package file.
.Ef
.Sh OPTIONS
The following command line arguments are supported:
.Bl -tag -width indent
.It Ar pkg-name Op Ar pkg-name ...
The named packages are installed. A package name of - will cause
.Nm
to read from stdin.
If the packages are not found in the current
working directory,
.Nm
will search them in each directory named by
.Ev PKG_PATH .
.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.
.It Fl n
Don't actually install a package, just report the steps that
would be taken if it was.
.It Fl R
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
.Nm
will still try to find and auto-install missing prerequisite packages,
a failure to find one will not be fatal.
.It Fl p Ar prefix
Set
.Ar prefix
as the directory in which to extract files from a package.
If a package has set its default directory, it will be overridden
by this flag. Note that only the first
.Cm @cwd
directive will be replaced, since
.Nm
has no way of knowing which directory settings are relative and
which are absolute. It is rare in any case to see more than one
directory transition made, but when such does happen and you wish
to have control over *all* directory transitions, then you
may then wish to look into the use of
.Cm MASTER
and
.Cm SLAVE
modes (see the
.Fl M
and
.Fl S
options).
.It Fl t Ar template
Use
.Ar template
as the input to
.Xr mktemp 3
when creating a
.Dq staging area .
By default, this is the string
.Pa /var/tmp/instmp.XXXXXX ,
but it may be necessary to override it in the situation where
space in your
.Pa /var/tmp
directory is limited. Be sure to leave some number of `X' characters
for
.Xr mktemp 3
to fill in with a unique ID.
.Pp
You can get a performance boost by setting the staging area
.Ar template
to reside on the same disk partition as target directories for package
file installation; often this is
.Pa /usr .
.It Fl M
Run in
.Cm MASTER
mode. This is a very specialized mode for running
.Nm
and is meant to be run in conjunction with
.Cm SLAVE
mode. When run in this mode,
.Nm
does no work beyond extracting the package into a temporary staging
area (see the
.Fl t
option), reading in the packing list, and then dumping it (prefaced by
the current staging area) to stdout where it may be filtered by a
program such as
.Xr sed 1 .
When used in conjunction with
.Cm SLAVE
mode, it allows you to make radical changes to the package structure
before acting on its contents.
.It Fl S
Run in
.Cm SLAVE
mode. This is a very specialized mode for running
.Nm
and is meant to be run in conjunction with
.Cm MASTER
mode. When run in this mode,
.Nm
expects the release contents to be already extracted and waiting
in the staging area, the location of which is read as a string
from stdin. The complete packing list is also read from stdin,
and the contents then acted on as normal.
.El
.Pp
One or more
.Ar pkg-name
arguments may be specified, each being either a file containing the
package (these usually end with a
.Dq .tgz
suffix) or a
URL pointing at a file available on an ftp site. Thus you may
extract files directly from their anonymous ftp locations (e.g.\&
.Nm
.Li ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/shells/bash-1.14.7.tgz ) .
Note: If you wish to use
.Bf -emphasis
passive mode
.Ef
ftp in such transfers, set
the variable
.Bf -emphasis
FTP_PASSIVE_MODE
.Ef
to some value in your environment. Otherwise, the more standard
ACTIVE mode may be used. If
.Nm
consistently fails to fetch a package from a site known to work,
it may be because you have a firewall that demands the usage of
.Bf -emphasis
passive mode
.Ef
ftp.
.Sh TECHNICAL DETAILS
The
.Nm
utility extracts each package's "packing list" into a special staging
directory in /tmp (or $PKG_TMPDIR if set), parses it, and then runs
through the following sequence to fully extract the contents of the package:
.Bl -enum
.It
A check is made to determine if the package is already recorded as installed.
If it is, installation is terminated.
.It
A check is made to determine if the package conflicts (from
.Cm @conflicts
directives, see
.Xr pkg_create 1 )
with an already-installed package.
If it is, installation is terminated.
.It
Scan all the package dependencies (from
.Cm @pkgdep
directives, see
.Xr pkg_create 1 )
are read from the packing list.
If any of these required packages is not currently installed,
an attempt is made to find and install it;
if the missing package cannot be found or installed,
the installation is terminated.
.It
Search for any
.Cm @option
directives which control how the package is added to the system.
At the time of this writing, the only currently implemented option is
.Cm @option extract-in-place
which will cause the package to be extracted directly into its
prefix directory without moving through a staging area in
.Pa /tmp .
.It
If
.Cm @option extract-in-place
is enabled, the package is now extracted directly into its
final location, otherwise it is extracted into the staging area.
.It
If the package contains a
.Ar require
file (see
.Xr pkg_create 1 ) ,
then execute it with the following arguments:
.Bd -ragged -offset indent -compact
.Ar pkg-name
.Ar INSTALL
.Ed
where
.Ar pkg-name
is the name of the package in question and the
.Ar INSTALL
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:
.Bd -ragged -offset indent -compact
.Cm script
.Ar pkg-name
.Ar PRE-INSTALL
.Ed
.Pp
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.
.Pp
.Sy 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
.Fl i
and
.Fl I
flags to
.Xr pkg_create 1 ) .
.It
If
.Cm @option extract-in-place
is not used, then the packing list (this is the
.Pa +CONTENTS
file) is now used as a guide for moving (or copying, as necessary) files from
the staging area into their final locations.
.It
If the package contains an
.Ar mtreefile
file (see
.Xr pkg_create 1 ) ,
then mtree is invoked as:
.Bd -ragged -offset indent -compact
.Cm mtree
.Fl u
.Fl f
.Ar mtreefile
.Fl d
.Fl e
.Fl p
.Pa prefix
.Ed
where
.Pa prefix
is either the prefix specified with the
.Fl p
flag or, if no
.Fl p
flag was specified, the name of the first directory named by a
.Cm @cwd
directive within this package.
.It
If a
.Ar post-install
script exists for the package, it is then executed as
.Bd -ragged -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.
.Pp
.Sy 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
.Fl i
and
.Fl I
flags to
.Xr pkg_create 1 ) .
.Pp
Reasoning behind passing keywords such as
.Ar POST-INSTALL
and
.Ar PRE-INSTALL
is that this allows you to write a single
.Ar install
script that does both
.Dq before and after
actions.
But, separating the
functionality is more advantageous and easier from a maintenance viewpoint.
.It
After installation is complete, a copy of the packing list,
.Ar deinstall
script, description, and display files are copied into
.Pa /var/db/pkg/<pkg-name>
for subsequent possible use by
.Xr pkg_delete 1 .
Any package dependencies are recorded in the other packages'
.Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY
file
(if the environment variable PKG_DBDIR is set, this overrides the
.Pa /var/db/pkg/
path shown above).
.It
Finally, the staging area is deleted and the program terminates.
.El
.Pp
All the scripts are called with the environment variable
.Ev PKG_PREFIX
set to the installation prefix (see the
.Fl p
option above). This allows a package author to write a script
that reliably performs some action on the directory where the package
is installed, even if the user might change it with the
.Fl p
flag to
.Cm pkg_add .
.Sh ENVIRONMENT
The value of the
.Ev PKG_PATH
is used if a given package can't be found. The environment variable
should be a series of entries separated by colons. Each entry
consists of a directory name.
The current directory may be indicated
implicitly by an empty directory name, or explicitly by a single
period.
.Pp
The environment variable
.Ev PKG_DBDIR
specifies an alternative location for the installed package database,
default location is
.Pa /var/db/pkg .
.Pp
The environment variables
.Ev PKG_TMPDIR
and
.Ev TMPDIR ,
in that order, are taken to name temporary directories where
.Nm
will attempt to create its staging area in.
If these variables are not present or if the directories named lack
sufficient space, then
.Nm
will use the first of
.Pa /var/tmp ,
.Pa /tmp
or
.Pa /usr/tmp
with sufficient space.
.Pp
The environment variable
.Ev PACKAGEROOT
specifies an alternate location for
.Nm
to fetch from.
The fetch URL is built using this environment variable and the automatic
directory logic that
.Nm
uses when the
.Fl r
option is invoked.
An example setting would be
.Qq Li ftp://ftp3.FreeBSD.org .
.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.
Thus it should be a complete URL to the remote package file(s).
.Sh FILES
.Bl -tag -width /var/db/pkg -compact
.It Pa /var/tmp
Temporary directory for creating the staging area, if environmental variables
.Ev PKG_TMPDIR
or
.Ev TMPDIR
do not point to a suitable directory.
.It Pa /tmp
Next choice if
.Pa /var/tmp
does not exist or has insufficient space.
.It Pa /usr/tmp
Last choice if
.Pa /var/tmp
and
.Pa /tmp
are not suitable for creating the staging area.
.It Pa /var/db/pkg
Default location of the installed package database.
.El
.Sh SEE ALSO
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
.Xr pkg_update 1 ,
.Xr pkg_version 1 ,
.Xr mktemp 3 ,
.Xr sysconf 3 ,
.Xr mtree 8
.Sh AUTHORS
.An Jordan Hubbard
.Sh CONTRIBUTORS
.An John Kohl Aq jt...@ra...
.Sh BUGS
Hard links between files in a distribution are only preserved if either
(1) the staging area is on the same file system as the target directory of
all the links to the file, or (2) all the links to the file are bracketed by
.Cm @cwd
directives in the contents file,
.Em and
the link names are extracted with a single
.Cm tar
command (not split between
invocations due to exec argument-space limitations--this depends on the
value returned by
.Fn sysconf _SC_ARG_MAX ) .
.Pp
Sure to be others.
1.2 +4 -4 freepkg/create/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/create/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:06:27 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:28 -0000 1.2
@@ -1,13 +1,13 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:06:27 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:28 jlea Exp $
-PROG= pkg_create
+PROG= fpkg_create
SRCS= main.c
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
WARNS?= 2
-DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD= ${LIBINSTALL} -lfetch -lmd
+DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBFPKG} -lfetch -lmd
.include <bsd.prog.mk>
1.2 +27 -14 freepkg/create/main.c
Index: main.c
===================================================================
RCS file: /cvsroot/fpkg/freepkg/create/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.c 26 Apr 2004 00:06:32 -0000 1.1
+++ main.c 29 Apr 2004 13:25:28 -0000 1.2
@@ -1,17 +1,34 @@
-#ifndef lint
-static const char rcsid[] =
- "$Id: main.c,v 1.1 2004/04/26 00:06:32 jlea Exp $";
-#endif
-
/*
- * FreeBSD install - a package for the installation and maintainance
- * of non-core utilities.
+ * FreePKG - A utility for managing 3rd party software.
*
- * Jordan K. Hubbard
- * 18 July 1993
+ * 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 is the create module.
+ * 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.
+ *
+ * Jeremy D. Lea
+ * 22 April 2004.
+ *
+ * Based on pkg_install, by:
+ * Jordan K. Hubbard
+ * 18 July 1993
*
+ * This is the create module.
*/
#include <sys/param.h>
@@ -116,15 +133,11 @@
case 'L':
if ((cp = strchr(optarg, ':')) != NULL)
*cp++ = '\0';
- else
- cp = NULL;
add_depend_entry(&pi.dl, DEPEND_LIB, optarg, cp);
break;
case 'R':
if ((cp = strchr(optarg, ':')) != NULL)
*cp++ = '\0';
- else
- cp = NULL;
add_depend_entry(&pi.dl, DEPEND_RUN, optarg, cp);
break;
case '?':
1.1 freepkg/create/fpkg_create.1
.\"
.\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities.
.\"
.\" 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.
.\"
.\" Jordan K. Hubbard
.\"
.\"
.\" @(#)pkg_create.1
.\" $FreeBSD: src/usr.sbin/pkg_install/create/pkg_create.1,v 1.35.2.18 2003/09/03 08:23:56 roam Exp $
.\"
.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords,
.\" added dependency tracking, etc.
.\"
.\" [jkh] Took John's changes back and made some additional extensions for
.\" better integration with FreeBSD's new ports collection.
.\"
.Dd April 21, 1995
.Dt PKG_CREATE 1
.Os
.Sh NAME
.Nm pkg_create
.Nd a utility for creating software package distributions
.Sh SYNOPSIS
.Nm
.Op Fl YNOhjvyz
.Op Fl C Ar conflicts
.Op Fl P Ar pkgs
.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
.Op Fl X Ar excludefile
.Op Fl D Ar displayfile
.Op Fl m Ar mtreefile
.Op Fl o Ar originpath
.Fl c Ar comment
.Fl d Ar description
.Fl f Ar packlist
.Ar pkg-filename
.Nm
.Op Fl YNhvy
.Fl b Ar pkg-name
.Op Ar pkg-filename
.Sh DESCRIPTION
The
.Nm
command is used to create packages that will subsequently be fed to
one of the package extraction/info utilities. The input description
and command line arguments for the creation of a package are not
really meant to be human-generated, though it is easy enough to
do so. It is more expected that you will use a front-end tool for
the job rather than muddling through it yourself. Nonetheless, a short
description of the input syntax is included in this document.
.Sh OPTIONS
The following command line options are supported:
.Bl -tag -width indent
.It Fl f Ar packinglist
Fetch
.Dq packing list
for package from the file
.Ar packinglist
or
.Cm stdin
if
.Ar packinglist
is a
.Cm -
(dash).
.It Fl c Xo
.Oo Fl Oc Ns Ar desc
.Xc
Fetch package
.Dq one line description
from file
.Ar desc
or, if preceded by
.Cm - ,
the argument itself. This string should also
give some idea of which version of the product (if any) the package
represents.
.It Fl d Xo
.Oo Fl Oc Ns Ar desc
.Xc
Fetch long description for package from file
.Ar desc
or, if preceded by
.Cm - ,
the argument itself.
.It Fl Y
Assume a default answer of `Yes' for any questions asked.
.It Fl N
Assume a default answer of `No' for any questions asked.
.It Fl O
Go into a `packing list Only' mode. This is a custom hack for the
.Fx
.Em "Ports Collection"
and is used to do `fake pkg_add' operations when a port is installed.
In such cases, it is necessary to know what the final, adjusted packing
list will look like.
.It Fl v
Turn on verbose output.
.It Fl h
Force tar to follow symbolic links, so that the files they point to
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.
.Pp
.Sy Note :
if the
.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, after 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
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.
.It Fl C Ar conflicts
Set the initial package conflict list to
.Ar conflicts .
This is assumed to be a whitespace separated list of package names
and is meant as a convenient shorthand for specifying multiple
.Cm @conflicts
directives in the packing list (see PACKING LIST DETAILS section below).
.It Fl P Ar pkgs
Set the initial package dependency list to
.Ar pkgs .
This is assumed to be a whitespace separated list of package names
and is meant as a convenient shorthand for specifying multiple
.Cm @pkgdep
directives in the packing list (see
.Sx "PACKING LIST DETAILS"
section below).
Each argument from the
.Ar pkgs
list could be in the form
.Ar pkgname Ns Op : Ns Ar pkgorigin ,
where optional
.Ar pkgorigin
element denotes origin of each dependency from the list and it is
recorded into the packing list along with the
.Ar pkgname
using
.Cm @comment
directive.
.It Fl p Ar prefix
Set
.Ar prefix
as the initial directory
.Dq base
to start from in selecting files for
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.
.Pp
.Sy Note :
if the
.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.
.It Fl r Ar rscript
Set
.Ar rscript
to be the
.Dq requirements
procedure for the package. This can be any
executable program (or shell script). It will be invoked automatically
at installation/deinstallation time to determine whether or not
installation/deinstallation should proceed.
To differentiate between installation and deinstallation, the keywords
.Ar INSTALL
and
.Ar DEINSTALL
are passed respectively, along with the package's name.
.It Fl s Ar srcdir
.Ar srcdir
will override the value of
.Cm @cwd
during package creation.
.It Fl t Ar template
Use
.Ar template
as the input to
.Xr mktemp 3 .
By default, this is the string
.Pa /tmp/instmp.XXXXXX ,
but it may be necessary to override it in the situation where
space in your
.Pa /tmp
directory is limited. Be sure to leave some number of `X' characters
for
.Xr mktemp 3
to fill in with a unique ID.
.It Fl X Ar excludefile
Pass
.Ar excludefile
as a
.Fl exclude-from
argument to
.Cm tar
when creating final package. See
.Cm tar
man page (or run
.Cm tar
with
.Fl -help
flag) for further information on using this flag.
.It Fl D Ar displayfile
Display the file (by concatenating it to stdout)
after installing the package. Useful for things like
legal notices on almost-free software, etc.
.It Fl m Ar mtreefile
Run
.Xr mtree 8
with input from mtreefile before the package is installed.
Mtree is invoked as
.Cm mtree
.Fl u
.Fl f
.Ar mtreefile
.Fl d
.Fl e
.Fl p
.Pa prefix ,
where
.Pa prefix
is the name of the first directory named by a
.Cm @cwd
directive.
.It Fl o Ar originpath
Record an
.Ar originpath ,
as location of the port from which package has been created in the
.Fx
.Em "Ports Collection" .
It should be in the form
.Pa MASTERCATEGORY/PORTDIR .
.It Fl j
Use
.Xr bzip2 1
utility to compress package tarball instead of
.Xr gzip 1 .
Please note that this option is a NO-OP if the format of the resulting
archive is explicitly specified by the recognizable suffix of
.Ar pkg-filename .
Currently
.Nm
recognizes the following suffixes:
.Pa .tbz , .tgz
and
.Pa .tar .
.It Fl y
Compatibility synonym for
.Fl j .
.It Fl z
Use
.Xr gzip 1
utility to compress package tarball.
.It Fl b Ar pkg-name
Create package file from a locally installed package named
.Ar pkg-name .
If the
.Ar pkg-filename
is not specified, then resulting archive will be created in the
current directory and named
.Ar pkg-name
with an appropriate extraction suffix applied.
.El
.Sh PACKING LIST DETAILS
The
.Dq packing list
format (see
.Fl f )
is fairly simple, being
nothing more than a single column of filenames to include in the
package. However, since absolute pathnames are generally a bad idea
for a package that could be installed potentially anywhere, there is
another method of specifying where things are supposed to go
and, optionally, what ownership and mode information they should be
installed with. This is done by embedding specialized command sequences
in the packing list. Briefly described, these sequences are:
.Bl -tag -width indent -compact
.It Cm @cwd Ar directory
Set the internal directory pointer to point to
.Ar directory .
All subsequent filenames will be assumed relative to this directory.
Note:
.Cm @cd
is also an alias for this command.
.It Cm @srcdir Ar directory
Set the internal directory pointer for _creation only_ to
.Ar directory .
That is to say that it overrides
.Cm @cwd
for package creation but not extraction.
.It Cm @exec Ar command
Execute
.Ar command
as part of the unpacking process. If
.Ar command
contains any of the following sequences somewhere in it, they will
be expanded inline. For the following examples, assume that
.Cm @cwd
is set to
.Pa /usr/local
and the last extracted file was
.Pa bin/emacs .
.Bl -tag -width indent -compact
.It Cm "%F"
Expands to the last filename extracted (as specified), in the example case
.Pa bin/emacs
.It Cm "\&%D"
Expand to the current directory prefix, as set with
.Cm @cwd ,
in the example case
.Pa /usr/local .
.It Cm "\&%B"
Expand to the
.Dq basename
of the fully qualified filename, that
is the current directory prefix, plus the last filespec, minus
the trailing filename. In the example case, that would be
.Pa /usr/local/bin .
.It Cm "%f"
Expand to the
filename
part of the fully qualified name, or
the converse of
.Cm \&%B ,
being in the example case,
.Pa emacs .
.El
.It Cm @unexec Ar command
Execute
.Ar command
as part of the deinstallation process. Expansion of special
.Cm %
sequences is the same as for
.Cm @exec .
This command is not executed during the package add, as
.Cm @exec
is, but rather when the package is deleted. This is useful
for deleting links and other ancillary files that were created
as a result of adding the package, but not directly known to
the package's table of contents (and hence not automatically
removable). The advantage of using
.Cm @unexec
over a deinstallation script is that you can use the
.Dq special sequence expansion
to get at files regardless of where they've
been potentially redirected (see
.Fl p ) .
.It Cm @mode Ar mode
Set default permission for all subsequently extracted files to
.Ar mode .
Format is the same as that used by the
.Cm chmod
command (well, considering that it's later handed off to it, that's
no surprise). Use without an arg to set back to default (extraction)
permissions.
.It Cm @option Ar option
Set internal package options, the only two currently supported ones
being
.Ar extract-in-place ,
which tells the pkg_add command not to extract the package's tarball
into a staging area but rather directly into the target
hierarchy (this is typically meant to be used only by distributions
or other special package types), and
.Ar preserve ,
which tells pkg_add to move any existing files out of the way,
preserving the previous contents (which are also resurrected on
pkg_delete, so caveat emptor).
.It Cm @owner Ar user
Set default ownership for all subsequently extracted files to
.Ar user .
Use without an arg to set back to default (extraction)
ownership.
.It Cm @group Ar group
Set default group ownership for all subsequently extracted files to
.Ar group .
Use without an arg to set back to default (extraction)
group ownership.
.It Cm @comment Ar string
Imbed a comment in the packing list. Useful in
trying to document some particularly hairy sequence that
may trip someone up later.
.It Cm @ignore
Used internally to tell extraction to ignore the next file (don't
copy it anywhere), as it's used for some special purpose.
.It Cm @ignore_inst
Similar to
.Cm @ignore ,
but the ignoring of the next file is delayed one evaluation cycle. This
makes it possible to use this directive in the
.Ar packinglist
file, so you can pack a
specialized datafile in with a distribution for your install script (or
something) yet have the installer ignore it.
.It Cm @name Ar name
Set the name of the package. This is mandatory and is usually
put at the top. This name is potentially different from the name of
the file it came in, and is used when keeping track of the package
for later deinstallation. Note that
.Nm
will derive this field from the package name and add it automatically
if none is given.
.It Cm @dirrm Ar name
Declare directory
.Pa name
to be deleted at deinstall time. By default, directories created by a
package installation are not deleted when the package is deinstalled;
this provides an explicit directory cleanup method. This directive
should appear at the end of the package list. If more than one
.Cm @dirrm
directives are used, the directories are removed in the order specified.
The
.Pa name
directory will not be removed unless it is empty.
.It Cm @mtree Ar name
Declare
.Pa name
as an
.Xr mtree 8
input file to be used at install time (see
.Fl m
above). Only the first
.Cm @mtree
directive is honored.
.It Cm @display Ar name
Declare
.Pa name
as the file to be displayed at install time (see
.Fl D
above).
.It Cm @pkgdep Ar pkgname
Declare a dependency on the
.Ar pkgname
package. The
.Ar pkgname
package must be installed before this package may be
installed, and this package must be deinstalled before the
.Ar pkgname
package is deinstalled. Multiple
.Cm @pkgdep
directives may be used if the package depends on multiple other packages.
.It Cm @conflicts Ar pkgcflname
Declare a conflict with the
.Ar pkgcflname
package, as the two packages contain references to the same files,
and so cannot co-exist on the same system.
.El
.Sh ENVIRONMENT
The environment variable
.Ev PKG_TMPDIR
names the directory where
.Nm
will attempt to create its temporary files.
If
.Ev PKG_TMPDIR
is not set,
the directory named by the contents of
.Ev TMPDIR
will be used.
If neither of
.Ev PKG_TMPDIR
and
.Ev TMPDIR
are set, the builtin defaults are used.
.Sh FILES
.Bl -tag -width /usr/tmp -compact
.It Pa /var/tmp
Temporary directory if environmental variables
.Ev PKG_TMPDIR
and
.Ev TMPDIR
are not set.
.It Pa /tmp
The next choice if
.Pa /var/tmp
does not exist.
.It Pa /usr/tmp
The last choice if
.Pa /tmp
is unsuitable.
.El
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
.Xr pkg_update 1 ,
.Xr pkg_version 1 ,
.Xr sysconf 3
.Sh HISTORY
The
.Nm
command first appeared in
.Fx .
.Sh AUTHORS
.An Jordan Hubbard
.Sh CONTRIBUTORS
.An John Kohl Aq jt...@ra...
.Sh BUGS
Hard links between files in a distribution must be bracketed by
.Cm @cwd
directives in order to be preserved as hard links when the package is
extracted. They additionally must not end up being split between
.Cm tar
invocations due to exec argument-space limitations (this depends on the
value returned by
.Fn sysconf _SC_ARG_MAX ) .
.Pp
Sure to be others.
1.2 +4 -4 freepkg/delete/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/delete/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:05:14 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:29 -0000 1.2
@@ -1,13 +1,13 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:29 jlea Exp $
-PROG= pkg_delete
+PROG= fpkg_delete
SRCS= main.c
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
WARNS?= 2
-DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD= ${LIBINSTALL} -lfetch -lmd
+DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBFPKG} -lfetch -lmd
.include <bsd.prog.mk>
1.2 +26 -14 freepkg/delete/main.c
Index: main.c
===================================================================
RCS file: /cvsroot/fpkg/freepkg/delete/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.c 26 Apr 2004 00:05:14 -0000 1.1
+++ main.c 29 Apr 2004 13:25:29 -0000 1.2
@@ -1,29 +1,41 @@
-#ifndef lint
-static const char rcsid[] =
- "$Id: main.c,v 1.1 2004/04/26 00:05:14 jlea Exp $";
-#endif
-
/*
- *
- * FreeBSD install - a package for the installation and maintainance
- * of non-core utilities.
+ * FreePKG - A utility for managing 3rd party software.
*
* 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.
+ * 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.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * Jordan K. Hubbard
- * 18 July 1993
+ * 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.
*
- * This is the delete module.
+ * Jeremy D. Lea
+ * 22 April 2004.
*
+ * Based on pkg_install, by:
+ * Jordan K. Hubbard
+ * 18 July 1993
+ *
+ * This is the delete module.
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id: main.c,v 1.2 2004/04/29 13:25:29 jlea Exp $";
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
1.1 freepkg/delete/fpkg_delete.1
.\"
.\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities.
.\"
.\" 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.
.\"
.\" Jordan K. Hubbard
.\"
.\"
.\" @(#)pkg_delete.1
.\" $FreeBSD: src/usr.sbin/pkg_install/delete/pkg_delete.1,v 1.16.2.9 2002/06/21 16:42:18 charnier Exp $
.\"
.Dd November 25, 1994
.Dt PKG_DELETE 1
.Os
.Sh NAME
.Nm pkg_delete
.Nd a utility for deleting previously installed software package distributions
.Sh SYNOPSIS
.Nm
.Op Fl dDfGinrvx
.Op Fl p Ar prefix
.Ar pkg-name ...
.Nm
.Fl a
.Op Ar flags
.Sh DESCRIPTION
The
.Nm
command is used to delete packages that have been previously installed
with the
.Xr pkg_add 1
command.
.Sh WARNING
.Bf -emphasis
Since the
.Nm
command may execute scripts or programs provided by a package file,
your system may be susceptible to
.Dq Em trojan horses
or other subtle
attacks from miscreants who create dangerous package files.
.Pp
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
.Cm @cwd ,
.Cm @mode
(check for setuid),
.Cm @dirrm ,
.Cm @exec ,
and
.Cm @unexec
directives, and/or use the
.Xr pkg_info 1
command to examine the installed package control files.
.Ef
.Sh OPTIONS
The following command line options are supported:
.Bl -tag -width indent
.It Ar pkg-name ...
The named packages are deinstalled.
.It Fl a
Unconditionally delete all currently installed packages.
.It Fl i
Request confirmation before attempting to delete each package,
regardless whether or not the standard input device is a
terminal.
.It Fl v
Turn on verbose output.
.It Fl D
If a deinstallation script exists for a given package, do not execute it.
.It Fl n
Don't actually deinstall a package, just report the steps that
would be taken if it were.
.It Fl p Ar prefix
Set
.Ar prefix
as the directory in which to delete files from any installed packages
which do not explicitly set theirs. For most packages, the prefix will
be set automatically to the installed location by
.Xr pkg_add 1 .
.It Fl d
Remove empty directories created by file cleanup. By default, only
files/directories explicitly listed in a package's contents (either as
normal files/directories or with the
.Cm @dirrm
directive) will be removed at deinstallation time. This option tells
.Nm
to also remove any directories that were emptied as a result of removing
the package.
.It Fl f
Force removal of the package, even if a dependency is recorded or the
deinstall or require script fails.
.It Fl G
Do not try to expand shell glob patterns in the
.Ar pkg-name
when selecting packages to be deleted (by default
.Nm
automatically expands shell glob patterns in the
.Ar pkg-name ) .
.It Fl x
Treat the
.Ar pkg-name
as a regular expression and delete all packages whose names match
that regular expression. Multiple regular expressions could be
provided, in that case
.Nm
deletes all packages that match at least one
regular expression from the list.
.It Fl r
Recursive removal. In addition to specified packages, delete all
packages that depend on those packages as well.
.El
.Sh TECHNICAL DETAILS
The
.Nm
utility
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
will list those dependent packages and refuse to delete the package
(unless the
.Fl f
option is given).
.Pp
If the package contains a
.Ar require
file (see
.Xr pkg_create 1 ) ,
then this is executed first as
.Bd -ragged -offset indent -compact
.Cm require
.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 that this is a deinstallation)
to see whether or not deinstallation should continue. A non-zero exit
status means no, unless the
.Fl f
option is specified.
.Pp
If a
.Cm deinstall
script exists for the package, it is executed before any files are removed.
It is this script's responsibility to clean up any additional messy details
around the package's installation, since all
.Nm
knows how to do is delete the files created in the original distribution.
The
.Nm deinstall
script is called as:
.Bd -ragged -offset indent -compact
.Cm script
.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.
.Pp
.Sy Note :
The
.Ar DEINSTALL
keyword will not appear if separate scripts for deinstall and post-deinstall
are given during package creation time (using the
.Fl k
and
.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.
.Pp
The
.Nm post-deinstall
script is called as:
.Bd -ragged -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.
.Pp
.Sy 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
.Fl k
and
.Fl K
flags to
.Xr pkg_create 1 ) .
.Pp
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.
.Pp
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.
.Pp
All scripts are called with the environment variable
.Ev PKG_PREFIX
set to the installation prefix (see the
.Fl p
option above). This allows a package author to write a script
that reliably performs some action on the directory where the package
is installed, even if the user might have changed it by specifying the
.Fl p
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.
.El
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_create 1 ,
.Xr pkg_info 1 ,
.Xr pkg_version 1 ,
.Xr mktemp 3 ,
.Xr mtree 8
.Sh AUTHORS
.An Jordan Hubbard
.Sh CONTRIBUTORS
.An John Kohl Aq jt...@ra...
.Sh BUGS
Sure to be some.
1.2 +3 -3 freepkg/fpkg/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/fpkg/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:05:14 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:30 -0000 1.2
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:30 jlea Exp $
PROG= fpkg
SRCS= main.c
@@ -7,7 +7,7 @@
WARNS?= 2
-DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD= ${LIBINSTALL} -lfetch -lmd
+DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBFPKG} -lfetch -lmd
.include <bsd.prog.mk>
1.2 +111 -20 freepkg/fpkg/main.c
Index: main.c
===================================================================
RCS file: /cvsroot/fpkg/freepkg/fpkg/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.c 26 Apr 2004 00:05:19 -0000 1.1
+++ main.c 29 Apr 2004 13:25:30 -0000 1.2
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$Id: main.c,v 1.1 2004/04/26 00:05:19 jlea Exp $");
+__FBSDID("$Id: main.c,v 1.2 2004/04/29 13:25:30 jlea Exp $");
#include <sys/param.h>
#include <sys/file.h>
@@ -55,32 +55,34 @@
main(int argc, char **argv)
{
int ch, err = 0;
- boolean all = FALSE, origin = FALSE;
+ boolean all = FALSE, origin = FALSE, quiet = FALSE;
+ unsigned int flags = PKG_SHOW_NONE;
char *cp;
match_list ml = { PLIST_HEAD_INITIALIZER };
which_list wl = { PLIST_HEAD_INITIALIZER };
which_entry *w;
- enum {
- DELETE,
- VERSION,
- WHICH
- } mode;
+ enum { DELETE, INFO, VERSION, WHICH } mode;
signal(SIGINT, cleanup);
signal(SIGHUP, cleanup);
+ pkg_mgr_init();
if (argc == 2 && !strcmp(argv[1], "-V")) {
printf("%s (%s-%s)\n",PKG_INSTALL_VERSION,MIN_PKG_FORMAT,PKG_FORMAT);
return 0;
}
+ /* XXX: (jlea) Ooops, conflict... */
if (argc == 4 && !strcmp(argv[1], "-t")) {
err = version_cmp(argv[2], argv[3]);
printf(err > 0 ? ">\n" : (err < 0 ? "<\n" : "=\n"));
return 0;
}
-
- pkg_mgr_init();
- while ((ch = getopt(argc, argv, "afhinop:tv")) != -1) {
+ if (argc == 3 && !strcmp(argv[1], "-e")) {
+ pkg_mgr_start();
+ return (pkg_mgr_check(optarg) ? 0 : 1);
+ }
+
+ while ((ch = getopt(argc, argv, "afhinop:qt:v")) != -1) {
switch (ch) {
case 'a':
all = TRUE;
@@ -101,10 +103,15 @@
case 'p':
strlcpy(PkgMgr.prefix_override, optarg, PATH_MAX);
break;
+ case 'q':
+ quiet = TRUE;
+ break;
case 'v':
PkgMgr.verbose = TRUE;
break;
case 't':
+ strlcpy(PkgMgr.mktmp_template, optarg, PATH_MAX);
+ break;
case 'h':
default:
usage();
@@ -119,13 +126,17 @@
/* Process our command */
/* XXX: (jlea) Add abbrev. */
- if (!strcmp(*argv, "delete"))
+ if (!strcmp(*argv, "delete")) {
mode = DELETE;
- else if (!strcmp(*argv, "version"))
+ } else if (!strcmp(*argv, "info")) {
+ mode = INFO;
+ if (!quiet)
+ PkgMgr.verbose = TRUE;
+ } else if (!strcmp(*argv, "version")) {
mode = VERSION;
- else if (!strcmp(*argv, "which"))
+ } else if (!strcmp(*argv, "which")) {
mode = WHICH;
- else
+ } else
usage();
switch(mode) {
@@ -147,6 +158,74 @@
argv += optind;
break;
+ case INFO:
+ while ((ch = getopt(argc, argv, "cdDfgiIkl:LmoprRsv")) != -1) {
+ switch (ch) {
+ case 'c':
+ flags |= PKG_SHOW_COMMENT;
+ break;
+ case 'd':
+ flags |= PKG_SHOW_DESC;
+ break;
+ case 'D':
+ flags |= PKG_SHOW_DISPLAY;
+ break;
+ case 'f':
+ flags |= PKG_SHOW_PLIST;
+ break;
+ case 'g':
+ flags |= PKG_SHOW_CHKSUM;
+ break;
+ case 'i':
+ flags |= PKG_SHOW_INSTALL;
+ break;
+ case 'I':
+ flags |= PKG_SHOW_INDEX;
+ break;
+ case 'k':
+ flags |= PKG_SHOW_DEINSTALL;
+ break;
+ case 'l':
+ PkgMgr.infoprefix = optarg;
+ break;
+ case 'L':
+ flags |= PKG_SHOW_FILES;
+ break;
+ case 'm':
+ flags |= PKG_SHOW_MTREE;
+ break;
+ case 'o':
+ flags |= PKG_SHOW_ORIGIN;
+ break;
+ case 'p':
+ flags |= PKG_SHOW_PREFIX;
+ break;
+ case 'r':
+ flags |= PKG_SHOW_REQUIRE;
+ break;
+ case 'R':
+ flags |= PKG_SHOW_REQBY;
+ break;
+ case 's':
+ flags |= PKG_SHOW_SIZE;
+ break;
+ case 'v':
+ /* Reasonable definition of 'everything' */
+ flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC |
+ PKG_SHOW_PLIST | PKG_SHOW_INSTALL |
+ PKG_SHOW_DEINSTALL | PKG_SHOW_REQUIRE |
+ PKG_SHOW_DISPLAY | PKG_SHOW_MTREE;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ all = (*argv == NULL);
+ break;
+
case VERSION:
while ((ch = getopt(argc, argv, "I:l:")) != -1) {
switch (ch) {
@@ -232,13 +311,19 @@
if ((err = pkg_mgr_delete(&ml)) != 0)
msg_warn("%d package deletion(s) failed", err);
break;
+ case INFO:
+ if (!flags)
+ flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC | PKG_SHOW_REQBY;
+ if ((err = pkg_mgr_show(&ml, flags)) != 0)
+ msg_warn("%d package(s) failed", err);
+ break;
case VERSION:
if ((err = pkg_mgr_version(&ml)) != 0)
msg_warn("%d package(s) failed", err);
break;
case WHICH:
if ((err = pkg_mgr_which(&wl)) != 0)
- msg_verbose("%d files not installed by packages", err);
+ msg_verbose("%d files not installed by packages.\n", err);
/* Return 1 if some files where found... */
err = (PLIST_EMPTY(&wl) ? 0 : 1);
break;
@@ -249,14 +334,20 @@
return err;
}
+
static void
usage()
{
- fprintf(stderr, "%s\n%s\n%s\n%s\n",
- "usage: pkg_admin [-fhnv] [-p prefix] command [options]",
- " pkg_admin -t v1 v2",
- "commands: delete [-dD] package [package] [...]",
- " version [-l mask] -[I index] [packages]");
+ fprintf(stderr,
+"usage: fpkg [-afhinoqv] [-p prefix] [-t template] command [options]\n"
+" fpkg -t v1 v2\n"
+" fpkg -e [package]\n"
+" fpkg -V\n"
+"commands: delete [-dD] [packages]\n"
+" info [-l mask] -[I index] [packages]\n"
+" version [-l mask] -[I index] [packages]\n"
+" which [-F file] -[L lib] [-P plist]\n"
+ );
exit(1);
}
1.2 +4 -4 freepkg/info/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/fpkg/freepkg/info/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 26 Apr 2004 00:06:22 -0000 1.1
+++ Makefile 29 Apr 2004 13:25:30 -0000 1.2
@@ -1,13 +1,13 @@
-# $Id: Makefile,v 1.1 2004/04/26 00:06:22 jlea Exp $
+# $Id: Makefile,v 1.2 2004/04/29 13:25:30 jlea Exp $
-PROG= pkg_info
+PROG= fpkg_info
SRCS= main.c
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
WARNS?= 2
-DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD= ${LIBINSTALL} -lfetch -lmd
+DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBFPKG} -lfetch -lmd
.include <bsd.prog.mk>
1.2 +22 -10 freepkg/info/main.c
Index: main.c
===================================================================
RCS file: /cvsroot/fpkg/freepkg/info/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.c 26 Apr 2004 00:06:22 -0000 1.1
+++ main.c 29 Apr 2004 13:25:30 -0000 1.2
@@ -1,22 +1,34 @@
/*
- *
- * FreeBSD install - a package for the installation and maintainance
- * of non-core utilities.
+ * FreePKG - A utility for managing 3rd party software.
*
* 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.
+ * 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.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * Jordan K. Hubbard
- * 18 July 1993
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ ...
[truncated message content] |