Commit graph

239 commits

Author SHA1 Message Date
jlam
29fefe52e3 * Creates a new variable PKGINFODIR (named similarly to PKGMANDIR)
that is a purely user-settable variable to represent the relative
  path under ${PREFIX} where info files are stored and "dir" files
  are managed.  PKGINFODIR defaults to "info".  INFO_DIR still works,
  but will be obsoleted after the 2006Q1 branch.

* Modify GNU_CONFIGURE_INFODIR to only honor ${PKGINFODIR} if the
  package installs directly into ${PREFIX} and not some subdirectory
  under ${PREFIX}.  This fixes packages that don't really honor
  $(infodir) all that well, and also avoids PLIST problems relating
  to directory removal for those packages.

* Since the majority of Emacs Lisp packages use GNU_CONFIGURE, just
  set GNU_CONFIGURE_INFODIR directly to ${EMACS_INFOPREFIX}, which is
  the Emacs-distro-specific location for info files.  Also pass
  EMACS_INFOPREFIX through PLIST_SUBST for PLIST substitution.

* INFO_FILES should be defined if the package installs info files.
  If the info files are not listed in the PLIST, then INFO_FILES
  must list the filenames for the info files installed by the package,
  which are assumed to be located in ${PREFIX}/${PKGINFODIR}.

* The plist module can now better detect info files listed in PLISTs
  and exports a command to the pkginstall module to append info file
  names to the +INFO_FILES scriptlet at install-time.

* The print-PLIST target is updated to properly list info files in
  the auto-generated PLIST.

* The check-files code is updated to skip all "dir" Info database files.
2006-03-20 01:48:57 +00:00
jlam
44b11e928c Modify the INSTALL script to allow for selective unpacking of a scriptlet. 2006-03-19 23:58:14 +00:00
jlam
8679fd0ed3 Ensure that we invoke a brand new make when creating the INSTALL/DEINSTALL
and rc.d scripts so that we source the latest makevars.mk file and
get the latest set of cached variables.  This fixes problems where
BUILDLINK_PREFIX.* wasn't being expanded correctly when substituting
into an INSTALL script.
2006-03-17 18:22:30 +00:00
jlam
47283bca00 Always run the pkginstall framework targets to generate the
INSTALL/DEINSTALL and rc.d scripts, regardless of whether NO_BUILD is
defined or not.

We do this by renaming the main "build" target to "_build", and creating
a new "build" target that has "_build" and "pkginstall" as dependencies.
This allows the "build" and "install" targets to be consecutive, so
no changes in behavior are visible to the user.

Because the pkginstall targets are no longer run within the protection
of the locks during the build phase, we need to manage locking within
a new "pkginstall" target.
2006-03-15 16:20:11 +00:00
jlam
d4ca1fbd6b Rototill of how the various template parts of the INSTALL and DEINSTALL
scripts are generated.  The various scriptlets in pkgsrc/mk/install
are now full templates that can be combined to form the INSTALL and
DEINSTALL scripts.  All of the templates have either leading or trailing
blank lines so that when they are concatentated, the full INSTALL and
DEINSTALL scripts will still be easy to read.

All of the generated template sources for the INSTALL and DEINSTALL
scripts are now stored in ${WRKDIR}/.pkginstall for local consistency
and have been renamed so that they are not dot-files.

The "data" for the +* scriptlets are now generated in a separate step
and instead of being appended to the unpacked scriptlet are now appended
to the INSTALL script itself.  When the scriptlets are unpacked, the
corresponding data lines for each scriptlet are pulled out of the
INSTALL script and put into the unpacked scriptlets.  This makes it
easy to append more data lines during the install phase without needing
to regenerate the INSTALL script.
2006-03-15 04:52:57 +00:00
tron
da6eed48b7 Sync variable names in comments with recent changes to install framework. 2006-03-14 11:19:57 +00:00
jlam
daad0f3d6c Modify the pkginstall framework so that it manages all aspects of
INSTALL/DEINSTALL script creation within pkgsrc.

If an INSTALL or DEINSTALL script is found in the package directory,
it is automatically used as a template for the pkginstall-generated
scripts.  If instead, they should be used simply as the full scripts,
then the package Makefile should set INSTALL_SRC or DEINSTALL_SRC
explicitly, e.g.:

	INSTALL_SRC=	${PKGDIR}/INSTALL
	DEINSTALL_SRC=	# emtpy

As part of the restructuring of the pkginstall framework internals,
we now *always* generate temporary INSTALL or DEINSTALL scripts.  By
comparing these temporary scripts with minimal INSTALL/DEINSTALL
scripts formed from only the base templates, we determine whether or
not the INSTALL/DEINSTALL scripts are actually needed by the package
(see the generate-install-scripts target in bsd.pkginstall.mk).

In addition, more variables in the framework have been made private.
The *_EXTRA_TMPL variables have been renamed to *_TEMPLATE, which are
more sensible names given the very few exported variables in this
framework.  The only public variables relating to the templates are:

	INSTALL_SRC		INSTALL_TEMPLATE
	DEINSTALL_SRC		DEINSTALL_TEMPLATE
				HEADER_TEMPLATE

The packages in pkgsrc have been modified to reflect the changes in
the pkginstall framework.
2006-03-14 01:14:26 +00:00
jlam
5ce2fd1e99 Cosmetic change: reorder some lines locally to make it easier for me
to understand.
2006-03-10 23:36:08 +00:00
jlam
509cd276cf Expose fewer knobs for a user to tweak by making more variables private. 2006-03-10 23:33:57 +00:00
jlam
6f31a709ac Don't define DEINSTALL_FILE or INSTALL_FILE if the corresponding *_SRC
variables are empty.
2006-03-10 22:23:02 +00:00
jlam
11d32442f2 Make it safe to include bsd.pkginstall.mk directly in bsd.pkg.mk, and
drop pkginstall.mk, which did the same thing.  Also, rework some of
the targets so that we avoid needing to inspect *_MEMBERS variables
within make -- we defer the check to the shell code invoked by the
targets.

All changes are internal and don't affect existing packages in a
visible way.
2006-03-09 23:31:51 +00:00
jlam
51cac88fb9 Reimplement the info-file handling so that we use an +INFO_FILES
scriptlet to manage the info-file registration.  The new scriptlet's
template is install/info-files.  Remove obsolete texinfo.mk and
install/install-info.

No changes to package Makefiles are necessary -- the re-implementation
is internal to pkgsrc infrastructure.
2006-03-09 00:20:27 +00:00
reed
242b073d74 For the user or group removal message, don't set they can be removed
if no other packages are using them, but if no other "software" is using
them. Just in case, they are using a user and/or group without a package
using it.
2006-03-07 20:31:17 +00:00
wiz
84df0e4aa1 Remove type1inst log file; improve empty dir detection;
needed by fonts/intlfonts, ok@ jlam.
2006-02-17 19:32:48 +00:00
jlam
5be03dad31 Add back USE_PKGINSTALL as a knob to force the pkginstall framework
to be used so that +INSTALL and +DEINSTALL scripts are generated.
This can be used in cases where it's not possible or not desirable to
use the auto-detection mechanism to decide whether the pkginstall
framework is needed.
2006-01-11 04:42:12 +00:00
wiz
faf65456ad Remove stuff that was marked for removal after 2005Q4. 2006-01-01 18:53:03 +00:00
jlam
6517d6f417 Allow avoiding the automatic update of the fonts databases by setting
PKG_UPDATE_FONTS_DB=no in the environment or /etc/mk.conf.  This can
be beneficial when installing large numbers of fonts packages into
the same directories as it avoids destroying and recreating the same
database files over and over again.  This might make it possible
someday to run fc-cache, which is sometimes very time-consuming, from
the +FONTS script automatically.
2005-12-29 14:10:01 +00:00
jlam
5128d7a9bb Test that a variable is defined before checking its value. Fix from
Thomas Klausner.
2005-12-29 13:47:43 +00:00
jlam
4ab7433a2c Teach the pkgsrc infrastructure to Just Know when the pkginstall
framework should be used.  This is implemented by creating a small
file mk/install/pkginstall.mk that guards the implementation makefile
mk/install/bsd.pkginstall.mk.  This guard file just checks whether
one of the pkginstall-related variables is non-empty, and if so, then
the implementation file is automatically included.  This completely
deprecates USE_PKGINSTALL, which no longer has any affect in pkgsrc.
2005-12-29 06:18:53 +00:00
jlam
f0aa85ac53 Re-implement the pkgsrc fonts-handling by integrating it into the
pkginstall framework:

  * Rewrite the mk/install/fonts script fragment as a scriptlet that's
    generated by the +INSTALL script during package installation.

  * Rename the FONTS_<TYPE>_DIRS variables to FONTS_DIRS.<type> to
    be more consistent with how "families" of variables are currently
    named in pkgsrc.

  * Rewrite mk/fonts.mk so that it's implemented in terms of the new
    functionality in the pkginstall framework.  This file will be
    obsoleted in the near future after packages have been transitioned
    to use the new functionality in the pkginstall framework.  Currently,
    packages will continue to work with no changes.

Integrating the fonts-handling into the pkginstall framework has the
benefit of generating a +FONTS scriptlet that may be run independently
of the +INSTALL scripts to (idempotently) update the fonts databases
and fix package installation errors.
2005-12-29 03:44:38 +00:00
rillig
999f8b6e04 Applied all quoting fixes found by "pkglint --autofix". 2005-12-05 22:07:07 +00:00
joerg
78ac3986eb Bless FreeBSD with the usergroup functions used by DragonFly. 2005-11-06 19:45:08 +00:00
joerg
a765c85f21 Implement usergroupfuncs for DragonFly using pw(8). 2005-10-28 20:09:38 +00:00
jlam
afe4d02303 usergroupfuncs.${OPSYS} actually replaces this file. Noted by <joerg>. 2005-10-28 20:05:46 +00:00
jlam
d7dc6cc191 Fix typo in comment. 2005-10-28 19:21:54 +00:00
jlam
ab5ad91e23 Fix a typo... missing a : before the Q variable qualifier, which caused
${PKG_SYSCONFDIR} to not be automatically creates/refcounted by the
+DIRS script for packages that only set CONF_FILES_PERMS and not
CONF_FILES or PKG_SYSCONFSUBDIR, e.g. security/sudo.  This caused
problems when PKG_SYSCONFBASE was set to a non-default directory that
didn't pre-exist, e.g. PKG_SYSCONFBASE=/etc/pkg.  Problem noted by
<jmmv>.
2005-09-30 16:39:26 +00:00
jlam
a1660a8258 Allow platform-specific overrides for creating new users and groups.
There is a default implementation of the shell functions adduser()
and addgroup() used by the +USERGROUP script that uses NetBSD/Solaris-style
useradd(8) and groupadd(8) commands.  A platform may override those
functions by creating pkgsrc/mk/install/usergroupfuncs.${OPSYS}.  This
fixes PR pkg/23061.
2005-09-26 22:12:35 +00:00
jlam
5b62763c63 Teach the +SHELLS helper script to not create an /etc/shells file if
one doesn't exist.  From now on, we only add the listed PKG_SHELL to
the /etc/shells file if it already exists.  This fixes PR pkg/27162.
2005-09-20 04:23:48 +00:00
rillig
1e0da006f3 Removed trailing white-space. 2005-08-24 22:43:02 +00:00
rillig
c6db2435e8 Fixed a typo and added a comment about when to remove the deprecation
error message about the double-backslash quoting in PKG_USERS.
2005-08-24 12:34:42 +00:00
rillig
6c7647173b This file must not be included by anything other than bsd.pkg.mk.
Enforce this by not writing it in a comment but checking it in the code.
2005-08-23 12:01:52 +00:00
rillig
7a95adad42 The real user name in PKG_USERS does not need to be escaped with double
backslashes anymore. A single backslash is enough. Changed the
definition in all affected packages. For those that are not caught, an
additional check is placed into bsd.pkginstall.mk.
2005-08-23 11:48:47 +00:00
rillig
50dc3acc56 Made the code for the shell file work on Solaris. 2005-08-23 10:00:50 +00:00
rillig
e3b7f76c55 Made the code to create the dirs file work on Solaris. 2005-08-23 09:51:35 +00:00
abs
4b9c2427e0 Avoid double // in the case where PREFIX is / (eg: shells/standalone-tcsh) 2005-08-23 09:33:14 +00:00
rillig
abb46cd4fa Made the code for the permissions file work on Solaris. 2005-08-23 09:29:06 +00:00
rillig
5be6707677 Shortened the code for the usergroup file and made it work even on Solaris. 2005-08-23 09:19:06 +00:00
rillig
06363de332 Cleaned up the code that parses the CONF_FILES etc. Now it is possible
again to have users and groups called "__dummy".
2005-08-23 08:58:20 +00:00
rillig
77246172ce Cleaned up the code for creating .install_files. Now only shell
constructs are used that are understood by the Solaris /bin/sh, too.
2005-08-23 08:54:29 +00:00
rillig
6158929acb I forgot to add the trailing slash when stripping ${PREFIX} from pathnames. 2005-08-22 08:07:38 +00:00
rillig
bce7c2b832 ... and corrected a bug I had overseen. I had only tested that the function
works, not that it works in its environment.
2005-08-21 22:29:45 +00:00
rillig
e55825d282 Simplified the strip_prefix function. Tested with /usr/bin/awk on Solaris,
nawk and gawk.
2005-08-21 22:27:09 +00:00
jlam
8463361cf4 Add a guideline for what should be listed in REQD_* variables -- they
should be files or directories under ${PREFIX}.
2005-08-20 02:22:02 +00:00
jlam
66030afca0 Define new variables for package Makefile use:
REQD_FILES, REQD_FILES_PERMS, REQD_FILES_MODE
	REQD_DIRS, REQD_DIRS_PERMS

These are the same as the CONF_* variables, except the files and
directories listed in REQD_* are always copied over, created or removed
(taking into account if there are user modifications from the originals,
etc.) regardless of the value of PKG_CONFIG.

The implementation involved pushing the knowledge of PKG_CONFIG,
PKG_RCD_SCRIPTS, PKG_CREATE_USERGROUP, and PKG_REGISTER_SHELLS into
the individual helper scripts.  The helper scripts are now always
invoked by the +INSTALL and +DEINSTALL scripts.  The +DIRS and +FILES
script have been enhanced to understand a new "f" flag that means
"force" to ignore the value of PKG_CONFIG and PKG_RCD_SCRIPTS.

Lastly, the +FILES script has been taught a new "r" flag just for rc.d
scripts and the +RCD_SCRIPTS script is now unnecessary.
2005-08-19 22:24:09 +00:00
jlam
bd2788d930 Merge CONF_FILES/SUPPORT_FILES and CONF_FILES_PERMS/SUPPORT_FILES_PERMS
as the INSTALL and DEINSTALL scripts no longer distinguish between
the two types of files.  Drop SUPPORT_FILES{,_PERMS} and modify the
packages in pkgsrc accordingly.
2005-08-19 18:12:36 +00:00
jlam
9fd655b06c Rewrite sub-script targets so be less susceptible to "make variable
overflow" by splitting up the huge "one-liner" scriptlets into smaller,
individually executable bits.
2005-08-19 17:20:33 +00:00
rillig
f3eae6da8c Fixed evaluation of the PKG_USERS and PKG_GROUPS variables. Noted by
martii on tech-pkg.
2005-08-05 07:06:47 +00:00
rillig
0c26db2d94 Bugfix for shells that don't allow "for i in ;", that is: an empty list. 2005-08-04 21:37:33 +00:00
rillig
408cdaea69 Some fixes for the Solaris shell. After set -- foo bar; set --; echo $#
outputs 2, but 0 would be expected. That means that the arguments to set
-- must never be empty. I added the necessary checks. I also used
for...done loops instead of set, as they are simpler and don't use
global variables.
2005-08-04 16:54:53 +00:00
rillig
17988cfcbd Replaced the shell substitution ${egfile#${PREFIX}/} with a shell
function that does the same. The Solaris /bin/sh does not know this type
of substitution. Now we could only have problems with /bin/sh which do
not know functions, but as we are using shell functions in many other
places, this should be fine.
2005-08-04 15:03:39 +00:00
jlam
fcf2722f04 When using pkginstall to create INSTALL/DEINSTALL scripts to handle
config files, directories, rc.d scripts, etc., use relative paths as
much as possible to avoid hard-coding the ${PREFIX}-location in which
the files should be installed.  Where full paths are specified, if
the path is within ${PREFIX}, then automatically strip off the ${PREFIX}
part when creating the entries for the helper scripts.  Also, modify
the helper scripts to understand that relative paths should be considered
to be relative to ${PKG_PREFIX}.
2005-07-29 21:41:04 +00:00
jlam
9813468816 * Separate out the shell registration into a separately unpacked script
+SHELL.

* Turn PKG_REGISTER_SHELLS into a variable that can be set in the shell
  environment so that admins can make a choice when installing from
  binary packages.

* PKG_SHELL is now a list of paths, and if the path is relative, then it
  is taken to be relative to ${PREFIX}.  Convert packages that set
  PKG_SHELL to take advantage of this new feature by changing the full
  paths to the shells into relative paths.
2005-07-29 18:32:17 +00:00
jlam
3de5d86818 Rewrite scripts to be more resilient to shells that exit immediately
if an untested command fails (see sh(1), "-e errexit").  Do this by
changing lines that look like:

	test expression && command
to
	test ! expression || command

so that the statement list always returns 0.  Also, back out revision
1.38 of pkgsrc/mk/install/install and modify the if-test to branch
correctly if +USERGROUP doesn't exist.
2005-07-27 16:18:54 +00:00
tron
95f029e269 Rewrite the code handling user and group creation so it will not fail if
no user or group needs to be created. This fixes PR pkg/30849 by myself.
2005-07-27 11:54:03 +00:00
jlam
5c44ecc864 Avoid creating unnecessary +* scripts, e.g. if no PKG_USERS or PKG_GROUPS
are specified, then don't create +USERGROUP, etc.
2005-07-27 04:55:43 +00:00
schmonz
d6a2862923 Remove the stanza to create ${RCD_SCRIPTS_EXAMPLEDIR} from the
install-rcd-${_script_} target; it gets created by mtree now.
2005-07-20 02:51:59 +00:00
jlam
962622ba7d Rename mk/bsd.pkg.install.mk to mk/install/bsd.pkginstall.mk to
consolidate the files for that framework in one directory.
2005-05-11 02:07:37 +00:00
seb
5858a961c1 Execute chmod(1) after chown(1)/chgrp(1) so NetBSD's chown(2) does
not reset any set-user-id or set-group-id bits we may want to set.

Approved by jlam@.
2005-04-20 17:13:28 +00:00
jmmv
1fa01b25e7 Fix typo. 2005-04-10 11:01:29 +00:00
jlam
bb43605988 Fix user_exists and group_exists to actually use their arguments
instead of using the values stored in global variables.  Also,
consistently prepend variables that should be local to functions with
an underscore.
2005-03-28 19:26:11 +00:00
wiz
b8a6cec645 Add -*- sh -*- comment at top of file; from PR 22947. 2005-03-21 19:29:46 +00:00
tv
7573aa3be5 Fix typo in previous (should have ended the line with &&). 2005-02-14 16:31:41 +00:00
tv
ded6da1cc5 Remove "test ... -ef ...", which is unportable. Currently this is causing
syntax errors (and unchanged example files to be left behind) on Interix;
it probably causes a problem on others.

(This test appears to work around a case where two files were exactly the
same by inode, and have the script *not* delete the file in that case.
I'm not exactly sure why that is desirable at all.)
2005-02-14 16:30:35 +00:00
jlam
a6f8c45bfc Next round of install script cleanup -- we now create +FILES,
+RCD_SCRIPTS, and +PERMS subscripts to handle copying config files
and rc.d scripts, and setting special permissions on files.  The +FILES
and +RCD_SCRIPTS are basically identical except for different embedded
packets of data, and they feature reference-counting for the files in
case multiple packages share the same config file.

Garbage-collect unused functions and definitions in the install scripts
now that the subscripts are self-contained.
2005-02-02 10:33:01 +00:00
jlam
a767f84684 In the usage message, note that the CHECK-* actions can take an optional
metadatadir argument.
2005-01-31 21:41:06 +00:00
jlam
db02fdf8d8 Note in the usage that CHECK-* take an optional metadatadir argument. 2005-01-31 20:32:58 +00:00
jlam
7ebb4d0225 Add missing "fi". 2005-01-31 19:53:31 +00:00
jlam
d621d74579 Fix automatically adding users and groups after the {GROUP,USER}ADD
definitions were removed from mk/install/headers.  The checks for
whether {GROUP,USER}ADD are defined are now moved to the usergroup
script.
2005-01-31 18:41:08 +00:00
jlam
7bb70d34b2 Add RCS Id. 2005-01-31 17:42:20 +00:00
jlam
0a8bdc04af Avoid hardcoding the refcount database into the INSTALL scripts. We
now simply make ${PKG_REFCOUNT_DBDIR} always be ${PKG_DBDIR}.refcount
so that it always follows the location of ${PKG_DBDIR}.  This preserves
the ability for PKG_DBDIR (and PKG_REFCOUNT_DBDIR) to be different on
different machines despite using the same binary packages.
2005-01-28 19:06:07 +00:00
jlam
39695d15ef Remove entries for GROUPADD and USERADD from header since they're all
handled within the usergroup script.
2005-01-28 18:05:34 +00:00
jlam
fc16f1f48c Pretty-print the users and groups that may need to be removed during
CHECK-REMOVE.  The users and groups are now printed on the same line
with whitespace separating the entries (for easy copy-and-pasting info
commands), and wrapping to successive lines if we overflow the length
of the current line.
2005-01-28 18:00:28 +00:00
jlam
f9d620373a Continue with install script cleanup -- we now create a +USERGROUP
script that is unpacked by the +INSTALL script at PRE-INSTALL time
before any other actions take place, and invoke +USERGROUP to create
any necessary users and groups.  Remove the now-unused code for
PKG_USERS and PKG_GROUPS from the install and deinstall templates.

We also reference count the users and groups and store the reference
counts in ${PKG_DBDIR}/.refcount/{users,groups}.  This allows multiple
packages to register that they use same users and groups, and allows
+USERGROUP to be invoked at any time to repair an installed package.

Also fix the install and deinstall templates to invoke the CHECK-*
actions with ${PKG_METADATA_DIR} so that the correct PKGNAME can be
derived.  This fixes the weird messages asking the user to create
directories for ".pkgdb" during a "make install".
2005-01-28 07:37:55 +00:00
jlam
5aa13ad4ee Use reference counts to properly account for the creation and removal
of directories needed for the proper functioning of each package.

The +INSTALL script unpacks a +DIRS script that adds and removes
directories.  The +DIRS script entirely encapsulates the directory
creation and removal, and completely replaces the code in the
mk/install/install and mk/install/deinstall templates that handled
{MAKE,OWN}_DIRS and {MAKE,OWN}_DIRS_PERMS.

The +DIRS script is meant to be executed from within the package
meta-data directory, e.g.  /var/db/pkg/<pkgname>.  It's usage is:

	./+DIRS ADD|REMOVE|CHECK-ADD|CHECK-REMOVE

The ADD and REMOVE actions cause the necessary directories to be added
or removed from the system.  The CHECK-ADD and CHECK-REMOVE actions
print out informative messages prompting the user to either create or
remove some necessary directories.

The behaviour of "ADD" is such that if the directory already exists
on the system and is not already ref-counted, then that directory is
marked as "pre-existing".  On "REMOVE", pre-existing directories are
left untouched on the filesystem.

At any time, the root user can sanity-check the directories needed by
packages by invoking all of the +DIRS scripts with the "CHECK-ADD"
action.  If there are missing directories, then invoking all of the
+DIRS scripts with the "ADD" action will ensure that any missing
directories are created.

The reference counts database is stored in ${PKG_DBDIR}/.refcount.
The reference counts related to directories managed by the +DIRS script
are stored in ${PKG_DBDIR}/.refcount/dirs.  If the directory reference
counts database is removed, then invoking all of the +DIRS scripts
with the "ADD" action will reconstruct the database; however, directories
may be marked as being pre-existing, so they won't be removed at
package de-installation (although a message will be displayed informing
the user that those directories can be removed).
2005-01-28 06:30:58 +00:00
jlam
840bee35ba If we fail the user/group existence test, then don't proceed to the
directory creation, which often need to create directories owned by
a particular user.
2005-01-06 23:44:35 +00:00
wiz
bc871f8be3 Fix ttf/type1 handling in fonts.mk:
Previously, ttmkfdir's output was redirected to fonts.dir,
while the correct behaviour is to let it create fonts.scale
and then let mkfontdir merge fonts.scale into fonts.dir.
type1 handling had a similar problem.
Get the wanted behaviour by automatically appending the contents of
FONTS_TTF_DIRS and FONTS_TYPE1_DIRS to FONTS_X11_DIRS.
Also, save a subshell in install/fonts while there.

Bump PKGREVISION for all affected packages.

jmmv@ says ok.
2004-12-28 14:38:03 +00:00
jlam
25b81680be Remove USERADD and GROUPADD definitions from OSes where the useradd
and groupadd commands won't follow the calling conventions of the
NetBSD useradd/groupadd.  Modify the INSTALL scripts to *never* create
users or groups if there is no available ${USERADD} or ${GROUPADD}
command, but will warn the user of users and groups that need to be
created before the package can be installed.
2004-12-27 06:41:50 +00:00
reed
15fee44a6c Make it so RCD_SCRIPTS_EXAMPLEDIR is a directory relative to
${PREFIX}. It is not an absolute path because with the automatic
addition of the entry to the PLIST would be bogus if someone
defined it to some RCD_SCRIPTS_EXAMPLEDIR outside of PREFIX.
(This may cause multiple rc.d directories if there are multiple
PREFIXes, but I think that is fine.)

Note that at this time, this doesn't change the RCD_SCRIPTS_EXAMPLEDIR
default directory. This will change soon.

Most of this has been in use for over a year.

Also some of this is from Greg Woods. Thank you Greg.

I will next update a few other references to RCD_SCRIPTS_EXAMPLEDIR.
2004-10-11 22:04:19 +00:00
salo
7adc0ac704 Replace test -e with -d and -f respectively.
Fixes part of PR pkg/26235 by Georg Schwarz.
2004-07-10 20:42:37 +00:00
tv
0830f78ac1 Add ECHO_N to the list of substituted variables in [DE]INSTALL. 2004-04-27 18:31:08 +00:00
chris
daed623ca8 Fix typo in deinstall message (many->may) 2004-04-12 11:49:09 +00:00
tv
decc954bc5 Elide use of "echo -n" in a platform-independent manner. 2004-04-07 14:25:41 +00:00
recht
3da5d6876e Generate fonts.dir correctly with the ttmkfdir2.
From PR 24968 by Jukka Salmi.
2004-03-30 11:55:02 +00:00
lukem
7f5e976c4d Set CONF_FILES_MODE from @CONF_FILES_MODE@. 2004-02-15 03:01:08 +00:00
grant
50c10804e4 fix minor formatting funny in last 2004-01-08 14:19:29 +00:00
grant
8b74d578fa tweak a message and some formatting. 2003-12-21 01:21:52 +00:00
jmmv
4b596947d5 Handle removal of fonts databases properly if the package is using
{MAKE,OWN}_DIRS (i.e., the .pkgsrc file exists in them).
2003-12-20 10:04:32 +00:00
jmmv
a58b3e0738 Define LS in install scripts (needed by install/fonts). 2003-12-20 09:45:55 +00:00
jmmv
456a588def Handle font (de)installation before bsd.pkg.install.mk handles OWN_DIRS.
This way font directories are not automatically removed; the package must
define OWN_DIRS if it wants them to be deleted during deinstallation.
This is done to avoid removal of standard font directories (those that
appear in *.dist files).
2003-12-19 23:46:41 +00:00
jmmv
fccf139b9f Use ${CD}, ${GREP}, ${RM} and ${RMDIR} instead of directly calling commands. 2003-12-19 23:18:49 +00:00
jlam
62fd86d085 In the overwrite package case:
* Ensure that VIEW-INSTALL is called after _all_ POST-INSTALL actions
     (including any in the INSTALL_EXTRA_TMPL file) by moving the call to
     a file that is included after all other INSTALL templates.

   * Ensure that VIEW-DEINSTALL is called before _all_ DEINSTALL actions
     (including any in the DEINSTALL_EXTRA_TMPL file) by moving the call to
     a file that is included before all other DEINSTALL templates.
2003-11-23 07:14:43 +00:00
jlam
546d3e35e4 Add some whitespace. 2003-11-23 07:03:07 +00:00
jlam
9cc646256d Back out part of rev. 1.20: rc.d scripts aren't really view files. 2003-11-21 10:54:14 +00:00
jlam
9eaf96b23a Back out part of rev. 1.24: we don't need to add config files to the view
if only rc.d scripts are present.  rc.d scripts always live in ${PREFIX}
regardless of the setting for ${PKG_SYSCONFBASE}.
2003-11-21 10:32:25 +00:00
seb
34bb1693e1 Add CVS signature. Noted by reed@. 2003-09-27 14:53:46 +00:00
grant
431d728069 fix regex when updating /etc/shells so that eg. "/bin/tcsh" doesn't
mistakenly cause the removal of eg. "/usr/pkg/bin/tcsh". PKG_SHELL
should be an absolute path, anyway.
2003-09-18 23:02:33 +00:00
jlam
399f83c526 Introduce a new variable "CONF_DEPENDS" for pkgviews: a package's
config directory matches the config directory for the dependency
listed in CONF_DEPENDS.  Use symlinks to physically point the
package's config directory to the dependency's config directory, and
handle all of this in the INSTALL/DEINSTALL scripts.

Also make the INSTALL/DEINSTALL scripts a bit smarter about not
copying files and not removing files if the source and destination
file locations point to the same thing.
2003-09-17 02:38:22 +00:00
jlam
435c602b22 Add the config files to the view also when there are rc.d scripts present.
Ignore any .pkgsrc files as those aren't meaningful for views.
2003-09-13 10:06:36 +00:00
jlam
08c49aada0 Make adding config files to views other than the default view work if
PKG_SYSCONFBASE points outside of ${PREFIX}.
2003-09-12 05:15:03 +00:00
jlam
19fd2859c5 Package Makefiles should refer to PKG_SYSCONFBASEDIR instead of
PKG_SYSCONFBASE when they want PKG_SYSCONFDIR stripped of
PKG_SYSCONFSUBDIR.  This makes PKG_SYSCONFBASE=/etc work with pkgviews by
installing all config files into /etc/packages/<pkg> instead of
occasionally putting some directly into /etc.

Also only create PKG_SYSCONFDIR if we're actually going to copy config
files.
2003-09-05 11:34:25 +00:00
jlam
841b57441b Merge pkgviews-mk branch into the HEAD by running:
cd pkgsrc/mk
	cvs update -Pd -A
	cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
2003-09-02 06:59:37 +00:00
jlam
8eeebf165b Add for use by the INSTALL/DEINSTALL scripts. 2003-08-30 18:42:36 +00:00
seb
783b9f53ba Try to deal with empty or "corrupted" Info directory file: if the
file exist when installing a package and it does not contain  at
least one line starting with '*' then remove it and let install-info
create a new one.

This should address PR pkg/22555 from reed@.
2003-08-22 18:17:03 +00:00
seb
58a5818ee0 Better error handling. 2003-06-25 22:45:14 +00:00
seb
082b66be00 At DEINSTALL time after un-registering info files from the Info
directory file remove it if it is empty i.e. if it contains only one
menu/entry line i.e. only one line starting with '*'.

This allow INFO_DIR to be set to a package specific directory while
not registering in the PLIST the Info directory file (${INFOR_DIR}/dir).

Registering such an Info directory file in the PLIST is not really
possible as a md5 signature of it holding the registered info entries
would be stored in PKG_DBDIR. At deinstall time this signature would not be
matched because the DEINSTALL script would have modified it by
un-registering the info files from it. Hence the package removal would
be reported as incomplete...

You are probably right if this looks like a hack to you...
2003-06-25 20:51:25 +00:00
jlam
5b02a8a8c4 Only change the owner/group/mode of a directory tree if it's not
pre-existing.  This should fix pkg/21975 by Matthias Scheler.
2003-06-25 08:26:51 +00:00
seb
5ab8be8066 Introduce a new framework to handle info files, install-info and
makeinfo commands.

The goal of the new framework is twofold:
        - reduce the number of '@exec' and '@unexec' in PLIST by
using INSTALL/DEINSTALL scripts to handle entries addition/removal
Info directory file.
        - achieve lighter dependencies by avoiding unnecessary run-time
dependency on the gtexinfo package and if needed with the help of the
standalone install-info command provided by the recently imported package
pkgtools/pkg_install-info.

A package must be sightly updated to use this new framework and
must define the variable USE_NEW_TEXINFO. This variable will
be removed from the pkgsrc tree when all package would have been
updated.

For details see section 10.24 of Packages.txt, comments in
mk/{texinfo.mk,buildlink2/bsd.buildlink2.mk} and upcoming mail to
<tech-pkg at netbsd dot org>.
2003-06-19 21:41:13 +00:00
jmmv
f1446ddf2b Drop trailing whitespace. Ok'ed by wiz. 2003-05-06 17:40:18 +00:00
jmmv
62f4d1bb45 Implement a simple framework to handle font databases. It regenerates the
fonts.dir, fonts.scale and Fontmap files (depending on the font type) in
the right directories at (de)install time.  Support included for TrueType,
Type1 and standard X11 fonts.

Reviewed by jlam.
2003-02-16 12:14:31 +00:00
jlam
9aaa6ee3c1 Create directories at pre-install time instead of post-install so that
we can more accurately determine if we "own" a directory.  Ownership is
determined by seeing if the directory doesn't exist before the package is
installed.
2003-01-29 19:47:29 +00:00
jlam
e44ac5236f Don't blindly assume that directores listed in OWN_DIRS* and MAKE_DIRS*
that are outside of ${LOCALBASE} belong to the package that lists them.
If the directory already exists before the package is installed, then
we don't presume ownership of the directory.

This addresses pkg/18383 by Grant Beattie.
2002-11-21 10:11:57 +00:00
salo
1fde293f32 Introduce new framework which unifies registering packages providing login
shells to /etc/shells.

This feature can be disabled by setting PKG_REGISTER_SHELLS to NO in
/etc/mk.conf.

An excerpt from Packages.txt, section 10.28:

 10.28 Packages providing login shells
 =====================================

If the purpose of the package is to provide a login shell, the variable
PKG_SHELL should contain the full pathname of the shell executable installed
by this package. The package Makefile also must include
"../../mk/bsd.pkg.install.mk" prior to the inclusion of bsd.pkg.mk to use the
automatically generated INSTALL/DEINSTALL scripts.

An example taken from shells/zsh:

        PKG_SHELL=      ${PREFIX}/bin/zsh
        .include "../../mk/bsd.pkg.install.mk"

The shell is registered into /etc/shells file automatically in the
post-install target by the INSTALL script generated by bsd.pkg.install.mk and
removed in the deinstall target by the DEINSTALL script.
2002-11-17 08:58:49 +00:00
jlam
416feb0be7 Unless PKG_RCD_SCRIPTS=YES and RCD_SCRIPTS is non-empty, don't create
${RCD_SCRIPTS_DIR} as it's not used at all.
2002-10-23 17:43:16 +00:00
heinz
834e71adf4 Only delete scripts in RCD_SCRIPTS_DIR if PKG_RCD_SCRIPTS is YES
(approved by jlam).
2002-10-17 16:15:14 +00:00
jlam
6502fab273 Recognize ${FIND} and ${XARGS}. 2002-10-08 11:32:34 +00:00
jlam
561ca1b8b7 Add new bsd.pkg.install.mk tunable variable: SPECIAL_PERMS.
SPECIAL_PERMS are lists that look like:
		file user group mode
	At post-install time, file (it may be a directory) is changed to be
	owned by user:group with mode permissions.

SPECIAL_PERMS should be used primarily to change permissions of files or
directories listed in the PLIST.  This may be used to make certain files
set-uid or to change the ownership or a directory.

Packages that install setuid executables should list them in SPECIAL_PERMS
so that the correct user and group will be used for file ownership, even
if the uid/gid changes between the package creation and the package
installation.
2002-10-04 23:46:26 +00:00
jlam
d940548856 Instead of the incredibly dense _print_* stuff, use a (hopefully) more
readable way of print messages.
2002-10-04 23:35:51 +00:00
jlam
072abe06cf Restore the ability to not automatically install the rc.d script into
/etc/rc.d.  This is controlled by the new variable PKG_RCD_SCRIPTS which
may be set in /etc/mk.conf or in the shell environment in which the
INSTALL script is executed.  PKG_RCD_SCRIPTS only takes effect if
${PKG_CONFIG} == "YES" and defaults to NO.
2002-09-19 10:20:50 +00:00
jlam
b119dbc8ef Merge pkgsrc/mk from the buildlink2 branch back into the main trunk. 2002-08-22 08:21:26 +00:00
jlam
e38613966f Create a new variable "RCD_SCRIPTS_EXAMPLEDIR" that contains the location
of the example rc.d scripts for a package.  This defaults to
${PREFIX}/etc/rc.d, but may be reset for those odd packages, e.g. qmail,
that set LOCALBASE=/.
2002-07-24 20:30:06 +00:00
jlam
8aca95c13e Don't bother the admin to create a directory from MAKE_DIRS if it already
exists on the system.  We still make noise about directories in
MAKE_DIRS_PERMS because those directories must have special permissions
that the admin should check, even if they do exist.
2002-06-27 20:46:31 +00:00
jlam
6697300211 Don't bother the admin about the ${PKG_SYSCONFBASE} and ${RCD_SCRIPTS_DIR}
directories if they still exist after we try to remove them.
2002-06-27 20:43:44 +00:00
jlam
ce7c65ef99 Put PKG_SYSCONFBASE and PKG_SYSCONFDIR in the header so that they may be
used in the scripts.
2002-06-27 20:42:15 +00:00
lukem
1217f73ea4 let mk.conf's PKG_CREATE_USERGROUP and PKG_CONFIG take advantage of
the same case insensitive multiple choice that the equivalents from
the environment support
2002-06-24 13:14:41 +00:00
jlam
063b3c32e8 Change PKG_CREATE_USERGROUP and PKG_CONFIG so that their values are merely
defaults for the INSTALL/DEINSTALL scripts.  The environment variables of
the same name take precedence during installation of a binary package.
2002-06-22 02:48:35 +00:00
jlam
f28a0a731b In order to solve the following problems:
(1) Admins want to create users/groups on their own (pkg/17183).
    (2) Admins don't want packages to setup an initial configuration.

The bsd.pkg.install.mk-generated INSTALL/DEINSTALL scripts have been
modified to check certain PKG_* environment variables to tune their
behaviour.  This works whether installing from "make install" or from a
binary package.

PKG_CREATE_USERGROUP indicates whether the INSTALL script should
	automatically add any needed users/groups to the system using
	useradd/groupadd.  It is either YES or NO, and defaults to YES.

PKG_CONFIG indicates whether the INSTALL/DEINSTALL scripts should do
	automatic config file and directory handling, or if it should
	merely inform the admin of the list of required files and
	directories needed to use the package.  It is either YES or NO,
	and defaults to YES.

The make(1) variable INSTALL_RCD_SCRIPTS is removed.  The package rc.d
script is now handled like other config files for the package, and is
copied into place if PKG_CONFIG=YES.

The default values above reflect the current behaviour.  Setting
PKG_CREATE_USERGROUP=NO solves problem (1), and setting PKG_CONFIG=NO
solves problem (2).

To simply matters for users installing directly from pkgsrc, these
variables may also be defined in /etc/mk.conf, but behaviour at deinstall
time may be surprising.  It is *HIGHLY* recommended that these values be
set in the shell environment instead.
2002-06-20 20:15:46 +00:00
jlam
31fdf27c0c Be more pervasive with previous change. 2002-01-23 15:02:27 +00:00
jlam
1269c18041 When copying config files, if the destination file already exists, then
tell user where the example file is located.  Patch provided by Stoned
Elipot <seb@netbsd.org> in private e-mail.
2002-01-23 15:01:08 +00:00
jlam
5519a9b4a6 bsd.pkg.install.mk lists many things in FILES_SUBST, and we should have
something to replace for each of those things in the header.
2002-01-10 12:05:26 +00:00
seb
1339fe73d0 Fix of commands invoking {USER,GROUP}ADD so that '-{u,g}' and '{user,group}id'
are two distinct shell words.
Reviewed by Johnny C. Lam.
2001-12-04 21:05:06 +00:00
jlam
22d02d6b3e Replace PKG_{USER,GROUP} with PKG_USERS and PKG_GROUPS:
PKG_USERS represents the users to create for the package.  It is a
	space-separated list of elements of the form

		user:group[:[userid][:[descr][:[home][:shell]]]]

	Only the user and group are required; everything else is optional,
	but the colons must be in the right places when specifying optional
	bits.  Note that if the description contains spaces, then spaces
	should be double backslash-escaped, e.g.

		foo:foogrp::The\\ Foomister

PKG_GROUPS represents the groups to create for the package.  It is a
	space-separated list of elements of the form

		group[:groupid]

	Only the group is required; the groupid is optional.

This solves the problem of what to do when there is more than one user or
group needed for a package, e.g. qmail.  Also add a bit more error-checking
to the INSTALL/DEINSTALL scripts.
2001-11-26 20:37:38 +00:00
jlam
ad7cbda464 In fit of paranoia after reading about the iTunes installer and given we
now work on Darwin, and then the discussion about allowing spaces in
user/group names, make these scripts work even if the inputs contain
spaces.  Yes, this is overkill, but after doing all of the work, I didn't
want to waste it.
2001-11-26 14:48:53 +00:00
jlam
04f059f6c0 Fix pasto: PKG_GROUP -> PKG_USERID. 2001-11-25 21:16:30 +00:00
jlam
cfd5b704a7 Allow ALL_{DIRS,FILES,MAKE_DIRS} to be appended to by the extra templates
so that the general INSTALL/DEINSTALL scripts can manage these extra files
and directories.
2001-11-25 18:54:57 +00:00
jlam
f1b957484f Change the way the RCD_SCRIPTS variable is used. It now just lists the
names of the scripts and is no longer a MLINKS-type variable.  The scripts
are copied into ${RCD_SCRIPTS_DIR} which defaults to /etc/rc.d for now.
It's unclear if Linux/Solaris would set RCD_SCRIPTS_DIR to something else.
2001-11-21 15:43:01 +00:00
jlam
9875ea4f1d Forgot an EOF in the last commit. 2001-11-21 05:38:03 +00:00
jlam
b74b76b756 Remind the user that some rc.conf settings may need to be removed after
the package has been deleted.
2001-11-20 19:31:58 +00:00
jlam
b1d477e863 For completeness, add a SUPPORT_FILES_PERMS that acts like CONF_FILES_PERMS
but the user isn't prompted to customize the files at post-install time.
2001-11-19 23:33:52 +00:00
jlam
c850f81b61 Common INSTALL/DEINSTALL scripts and Makefile magic to automatically perform
many of the tasks that need to be done when package is installed or
deinstalled:

	* creating user/group for the package,

	* creating and removing directories with special permissions and
	  ownership,

	* copying config files to their final locations, and removing them
	  at deinstall time if they don't differ from the example ones,

	* reminding the package admin of files he may want to customize or
	  of files/directories he may want to remove.
2001-11-19 16:18:44 +00:00