summaryrefslogtreecommitdiff
path: root/mk/install/deinstall
AgeCommit message (Collapse)AuthorFilesLines
2005-08-19Define new variables for package Makefile use:jlam1-23/+13
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-07-29* Separate out the shell registration into a separately unpacked scriptjlam1-7/+10
+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-27Rewrite scripts to be more resilient to shells that exit immediatelyjlam1-10/+10
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-03-21Add -*- sh -*- comment at top of file; from PR 22947.wiz1-1/+2
2005-02-02Next round of install script cleanup -- we now create +FILES,jlam1-98/+39
+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-01-28Continue with install script cleanup -- we now create a +USERGROUPjlam1-45/+8
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-28Use reference counts to properly account for the creation and removaljlam1-85/+5
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).
2004-10-11Make it so RCD_SCRIPTS_EXAMPLEDIR is a directory relative toreed1-2/+2
${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-07-10Replace test -e with -d and -f respectively.salo1-3/+3
Fixes part of PR pkg/26235 by Georg Schwarz.
2004-04-12Fix typo in deinstall message (many->may)chris1-2/+2
2004-04-07Elide use of "echo -n" in a platform-independent manner.tv1-7/+7
2003-11-23In the overwrite package case:jlam1-6/+1
* 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-21Back out part of rev. 1.20: rc.d scripts aren't really view files.jlam1-2/+1
2003-09-18fix regex when updating /etc/shells so that eg. "/bin/tcsh" doesn'tgrant1-2/+2
mistakenly cause the removal of eg. "/usr/pkg/bin/tcsh". PKG_SHELL should be an absolute path, anyway.
2003-09-17Introduce a new variable "CONF_DEPENDS" for pkgviews: a package'sjlam1-2/+10
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-13Add the config files to the view also when there are rc.d scripts present.jlam1-2/+4
Ignore any .pkgsrc files as those aren't meaningful for views.
2003-09-12Make adding config files to views other than the default view work ifjlam1-4/+4
PKG_SYSCONFBASE points outside of ${PREFIX}.
2003-09-05Package Makefiles should refer to PKG_SYSCONFBASEDIR instead ofjlam1-3/+3
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-02Merge pkgviews-mk branch into the HEAD by running:jlam1-14/+37
cd pkgsrc/mk cvs update -Pd -A cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
2003-05-06Drop trailing whitespace. Ok'ed by wiz.jmmv1-2/+2
2002-11-21Don't blindly assume that directores listed in OWN_DIRS* and MAKE_DIRS*jlam1-2/+8
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-17Introduce new framework which unifies registering packages providing loginsalo1-1/+7
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-10-23Unless PKG_RCD_SCRIPTS=YES and RCD_SCRIPTS is non-empty, don't createjlam1-2/+2
${RCD_SCRIPTS_DIR} as it's not used at all.
2002-10-17Only delete scripts in RCD_SCRIPTS_DIR if PKG_RCD_SCRIPTS is YESheinz1-8/+10
(approved by jlam).
2002-08-22Merge pkgsrc/mk from the buildlink2 branch back into the main trunk.jlam1-1/+1
2002-07-24Create a new variable "RCD_SCRIPTS_EXAMPLEDIR" that contains the locationjlam1-2/+2
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-06-27Don't bother the admin about the ${PKG_SYSCONFBASE} and ${RCD_SCRIPTS_DIR}jlam1-4/+14
directories if they still exist after we try to remove them.
2002-06-20In order to solve the following problems:jlam1-79/+61
(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.
2001-11-26Replace PKG_{USER,GROUP} with PKG_USERS and PKG_GROUPS:jlam1-17/+50
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-26In fit of paranoia after reading about the iTunes installer and given wejlam1-46/+64
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-25Allow ALL_{DIRS,FILES,MAKE_DIRS} to be appended to by the extra templatesjlam1-4/+4
so that the general INSTALL/DEINSTALL scripts can manage these extra files and directories.
2001-11-21Change the way the RCD_SCRIPTS variable is used. It now just lists thejlam1-2/+10
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-21Forgot an EOF in the last commit.jlam1-1/+2
2001-11-20Remind the user that some rc.conf settings may need to be removed afterjlam1-1/+8
the package has been deleted.
2001-11-19For completeness, add a SUPPORT_FILES_PERMS that acts like CONF_FILES_PERMSjlam1-4/+4
but the user isn't prompted to customize the files at post-install time.
2001-11-19Common INSTALL/DEINSTALL scripts and Makefile magic to automatically performjlam1-0/+153
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.