Subject: Re: put DEF_UMASK in /etc/mk.conf ?
To: Martin Weber <Ephaeton@gmx.net>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 03/04/2002 18:37:00
--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Feb 16, 2002 at 06:51:21AM +0100, Martin Weber wrote:
> Yo package wizards, I have a question:
> 
> When setting your umask to something different than the DEF_UMASK in defs.*
> from pkgsrc/mk when compiling from source in pkgsrc, you end up with an warning
> and a hint to set your umask to the value proposed by DEF_UMASK.
> 
> Imho it's cleaner to have a place where to define the umask you *really* want
> to use when building packages. This way you could have your umask you're used
> to (377 in my case :) and still build sane packages (i.e. e.g. man pages which
> are world readable) with one simple tuning (altering the DEF_UMASK variable in
> /etc/mk.conf), and have that value be used throughout the system, not the inherited
> umask from your setting.
> 
> In the light of the platform dependant DEF_UMASKs in the various def.* files
> I am not sure if this is able to be done portably, so that's why I ask...
> 
> So, what do you think ?

The following diffs allow you to specify a 3-octal-digit in your
/etc/mk.conf, and the right thing will happen, regardless of what
Operating System you're running on.

They seem to DTRT for me - let me know if it fixes the problem
you were seeing, since I use a standard umask.

Thanks,
Alistair

PS. Please ignore the first change to bsd.pkg.defaults.mk - that comes
from something else which is being worked on right now.

--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=umask-diffs

Index: bsd.pkg.defaults.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.defaults.mk,v
retrieving revision 1.39
diff -u -r1.39 bsd.pkg.defaults.mk
--- bsd.pkg.defaults.mk	2002/03/03 23:29:48	1.39
+++ bsd.pkg.defaults.mk	2002/03/04 17:32:53
@@ -55,6 +55,20 @@
 # Possible: defined, not defined
 # Default: not defined
 
+INSTALLATION_TYPE?= staged
+# Use staged installation types when installing a package - install it
+# into a staging area first, make a binary package, and then install
+# the binary package into the desired location
+# Possible: overwrite, staged
+# Default: overwrite
+
+DEFAULT_UMASK?= 022
+# Use this umask when building the package. The umask must be 3 characters
+# in length (it will be extended to 4 automatically if the underlying
+# Operating System needs it).
+# Possible: any 3-digit octal umask
+# Default: 022
+
 
 #
 # The following values are used to manage the packages collection as a whole.
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.940
diff -u -r1.940 bsd.pkg.mk
--- bsd.pkg.mk	2002/03/04 17:21:46	1.940
+++ bsd.pkg.mk	2002/03/04 17:32:59
@@ -1980,9 +1980,9 @@
 		exit 1;							\
 	fi
 .endif # !NO_PKG_REGISTER && !NO_FORCE_REGISTER
-	${_PKG_SILENT}${_PKG_DEBUG}if [ `${SH} -c umask` -ne ${DEF_UMASK} ]; then \
+	${_PKG_SILENT}${_PKG_DEBUG}if [ `${SH} -c umask` -ne ${_DEFAULT_UMASK_LEAD}${DEFAULT_UMASK} ]; then \
 		${ECHO_MSG} "${_PKGSRC_IN}>  Warning: your umask is \"`${SH} -c umask`"\".; \
-		${ECHO_MSG} "If this is not desired, set it to an appropriate value (${DEF_UMASK})"; \
+		${ECHO_MSG} "If this is not desired, set it to an appropriate value (${_DEFAULT_UMASK_LEAD}${DEFAULT_UMASK})"; \
 		${ECHO_MSG} "and install this package again by \`\`${MAKE} deinstall reinstall''."; \
 	fi
 .if !defined(NO_MTREE)
Index: defs.Darwin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.Darwin.mk,v
retrieving revision 1.18
diff -u -r1.18 defs.Darwin.mk
--- defs.Darwin.mk	2002/02/27 04:41:22	1.18
+++ defs.Darwin.mk	2002/03/04 17:32:59
@@ -54,7 +54,6 @@
 WC?=		/usr/bin/wc
 XARGS?=		/usr/bin/xargs
 
-DEF_UMASK?=		0022
 DEFAULT_SERIAL_DEVICE?=	/dev/null
 GROUPADD?=		${FALSE}			# XXX - Fix me!
 MOTIF_TYPE_DEFAULT?=	openmotif	# default 2.0 compatible libs type
@@ -67,6 +66,7 @@
 USERADD?=		${FALSE}			# XXX - Fix me!
 ZOULARISBASE?=		${DESTDIR}/usr/pkg
 
+_DEFAULT_UMASK_LEAD=	0	# umask needs 4 chars
 _DO_LIBINTL_CHECKS=	yes	# perform checks for valid libintl
 _DO_SHLIB_CHECKS=	no	# on installation, fixup PLIST for shared libs
 _IMAKE_MAKE=		${MAKE}	# program which gets invoked by imake
Index: defs.Linux.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.Linux.mk,v
retrieving revision 1.23
diff -u -r1.23 defs.Linux.mk
--- defs.Linux.mk	2002/02/27 04:41:22	1.23
+++ defs.Linux.mk	2002/03/04 17:32:59
@@ -58,7 +58,6 @@
 WC?=		/usr/bin/wc
 XARGS?=		/usr/bin/xargs -r
 
-DEF_UMASK?=		022
 DEFAULT_SERIAL_DEVICE?=	/dev/null
 GROUPADD?=		/usr/sbin/groupadd
 MOTIF_TYPE_DEFAULT?=	openmotif	# default 2.0 compatible libs type
@@ -71,6 +70,7 @@
 USERADD?=		/usr/sbin/useradd
 ZOULARISBASE?=		${DESTDIR}/usr/local/bsd
 
+_DEFAULT_UMASK_LEAD=		# umask needs 3 chars
 _DO_LIBINTL_CHECKS=	no	# perform checks for valid libintl
 _DO_SHLIB_CHECKS=	no	# on installation, fixup PLIST for shared libs
 _IMAKE_MAKE=		${MAKE}	# program which gets invoked by imake
Index: defs.NetBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.NetBSD.mk,v
retrieving revision 1.22
diff -u -r1.22 defs.NetBSD.mk
--- defs.NetBSD.mk	2002/02/27 04:41:23	1.22
+++ defs.NetBSD.mk	2002/03/04 17:32:59
@@ -65,7 +65,6 @@
 .endif
 .endif
 
-DEF_UMASK?=		0022
 MOTIF_TYPE_DEFAULT?=	openmotif	# default 2.0 compatible libs type
 MOTIF12_TYPE_DEFAULT?=	lesstif12	# default 1.2 compatible libs type
 NOLOGIN?=		/sbin/nologin
@@ -73,6 +72,7 @@
 ROOT_USER?=		root
 ROOT_GROUP?=	wheel
 
+_DEFAULT_UMASK_LEAD=	0	# umask needs 4 chars
 _DO_LIBINTL_CHECKS=	yes	# perform checks for valid libintl
 _DO_SHLIB_CHECKS=	yes	# fixup PLIST for shared libs/run ldconfig
 _IMAKE_MAKE=		${MAKE}	# program which gets invoked by imake
Index: defs.SunOS.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.SunOS.mk,v
retrieving revision 1.21
diff -u -r1.21 defs.SunOS.mk
--- defs.SunOS.mk	2002/02/27 04:41:23	1.21
+++ defs.SunOS.mk	2002/03/04 17:33:02
@@ -65,7 +65,6 @@
 WC?=		/usr/bin/wc
 XARGS?=		/usr/bin/xargs
 
-DEF_UMASK?=		022
 DEFAULT_SERIAL_DEVICE?=	/dev/null
 GROUPADD?=		/usr/sbin/groupadd
 MOTIF_TYPE_DEFAULT?=	dt		# default 2.0 compatible libs type
@@ -76,6 +75,7 @@
 SERIAL_DEVICES?=	/dev/null
 USERADD?=		/usr/sbin/useradd
 
+_DEFAULT_UMASK_LEAD=			# umask is 3 chars
 _DO_LIBINTL_CHECKS=	yes		# perform checks for valid libintl
 _DO_SHLIB_CHECKS=	yes		# fixup PLIST for shared libs
 _IMAKE_MAKE=	/usr/ccs/bin/make	# program which gets invoked by imake

--FL5UXtIhxfXey3p5--