Commit graph

83 commits

Author SHA1 Message Date
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