summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorsalo <salo>2002-11-17 08:58:49 +0000
committersalo <salo>2002-11-17 08:58:49 +0000
commitcd2da9cf82d999d76161960824ead8d8a846ffac (patch)
tree3e155d5246ed236de0b61794dce3b642fff4045a /mk
parent10c70866d58aa0b6edb481a6c90d2c2dff1373b5 (diff)
downloadpkgsrc-cd2da9cf82d999d76161960824ead8d8a846ffac.tar.gz
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.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.defaults.mk7
-rw-r--r--mk/bsd.pkg.install.mk13
-rw-r--r--mk/install/deinstall8
-rw-r--r--mk/install/header5
-rw-r--r--mk/install/install9
5 files changed, 37 insertions, 5 deletions
diff --git a/mk/bsd.pkg.defaults.mk b/mk/bsd.pkg.defaults.mk
index ee7e476bebf..f2853d1a8d9 100644
--- a/mk/bsd.pkg.defaults.mk
+++ b/mk/bsd.pkg.defaults.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.defaults.mk,v 1.106 2002/11/16 05:26:28 uebayasi Exp $
+# $NetBSD: bsd.pkg.defaults.mk,v 1.107 2002/11/17 08:58:49 salo Exp $
#
# A file providing defaults for pkgsrc and the packages collection.
@@ -66,6 +66,11 @@ PKGSRC_SLEEPSECS?= 5
# Possible: defined, not defined
# Default: not defined
+#PKG_REGISTER_SHELLS= YES
+# Automatically register shells in /etc/shells
+# Possible: YES, NO
+# Default: YES
+
PKGSRC_RUN_TEST?= no
# Run test target before install
# Possible: yes, no
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index 69a4a125784..bebf84a57df 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.38 2002/10/23 17:43:16 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.39 2002/11/17 08:58:50 salo Exp $
#
# This Makefile fragment is included by package Makefiles to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -213,6 +213,17 @@ FILES_SUBST+= PKG_CREATE_USERGROUP=${PKG_CREATE_USERGROUP}
FILES_SUBST+= PKG_CONFIG=${PKG_CONFIG}
FILES_SUBST+= PKG_RCD_SCRIPTS=${PKG_RCD_SCRIPTS}
+# PKG_REGISTER_SHELLS indicates whether to automatically register shells
+# in /etc/shells. It is either YES or NO and defaults to YES.
+#
+# PKG_SHELL contains the full pathname of the shell being installed.
+#
+
+PKG_REGISTER_SHELLS?= YES
+PKG_SHELL?= # empty
+FILES_SUBST+= PKG_REGISTER_SHELLS=${PKG_REGISTER_SHELLS}
+FILES_SUBST+= PKG_SHELL=${PKG_SHELL:Q}
+
# Substitute for various programs used in the DEINSTALL/INSTALL scripts and
# in the rc.d scripts.
#
diff --git a/mk/install/deinstall b/mk/install/deinstall
index debc3c768ab..854283fa15f 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,6 +1,6 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.14 2002/10/23 17:43:17 jlam Exp $
+# $NetBSD: deinstall,v 1.15 2002/11/17 08:58:50 salo Exp $
eval set -- ${PKG_USERS}
for userset; do
@@ -88,6 +88,12 @@ DEINSTALL)
fi
done
fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
+ ${ECHO} "===> Updating /etc/shells"
+ ${CP} /etc/shells /etc/shells.pkgsrc."$$"
+ (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
+ ${RM} /etc/shells.pkgsrc."$$"
+ fi
;;
POST-DEINSTALL)
diff --git a/mk/install/header b/mk/install/header
index fd49226ed43..32a4f0074a4 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.16 2002/10/08 11:32:34 jlam Exp $
+# $NetBSD: header,v 1.17 2002/11/17 08:58:50 salo Exp $
PKGNAME=$1
STAGE=$2
@@ -65,6 +65,9 @@ OWN_DIRS_PERMS="@OWN_DIRS_PERMS@"
PKG_SYSCONFBASE="@PKG_SYSCONFBASE@"
PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
+PKG_REGISTER_SHELLS="@PKG_REGISTER_SHELLS@"
+PKG_SHELL="@PKG_SHELL@"
+
ALL_USERS=
ALL_GROUPS=
ALL_FILES=
diff --git a/mk/install/install b/mk/install/install
index 554e6dd0fd8..a7f939dac7f 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.16 2002/10/23 17:43:17 jlam Exp $
+# $NetBSD: install,v 1.17 2002/11/17 08:58:51 salo Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -318,6 +318,13 @@ EOF
EOF
fi
fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
+ ${ECHO} "===> Updating /etc/shells"
+ ${TOUCH} /etc/shells
+ ${CP} /etc/shells /etc/shells.pkgsrc."$$"
+ (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}; ${ECHO} ${PKG_SHELL}) > /etc/shells
+ ${RM} /etc/shells.pkgsrc."$$"
+ fi
;;
*)