pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Document PRE_CMD.su-<target> and simplify its use i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/de0ee252e984
branches:  trunk
changeset: 363084:de0ee252e984
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed May 31 22:56:41 2017 +0000

description:
Document PRE_CMD.su-<target> and simplify its use in "su-target".

This avoids needing to use a shell command to test whether
${PRE_CMD.su-<target>} is empty before executing it.

diffstat:

 mk/bsd.pkg.mk |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r d5234082d80c -r de0ee252e984 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed May 31 22:56:22 2017 +0000
+++ b/mk/bsd.pkg.mk     Wed May 31 22:56:41 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2023 2017/05/31 22:55:01 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2024 2017/05/31 22:56:41 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -615,6 +615,12 @@
 # MAKEFLAGS.su-${.TARGET}
 #      The additional flags that are passed to the make process.
 #
+# PRE_CMD.su-${.TARGET}
+#      Shell command executed before running the command that requires
+#      root privileges.  This may "exit 0" to short-circuit the command
+#      list and skip executing the command that requires the root
+#      privileges.
+#
 
 _ROOT_CMD=     cd ${.CURDIR} &&                                        \
                ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV}                             \
@@ -626,11 +632,7 @@
 
 .PHONY: su-target
 su-target: .USE
-       ${RUN} \
-       case ${PRE_CMD.su-${.TARGET}:Q}"" in                            \
-       "")     ;;                                                      \
-       *)      ${PRE_CMD.su-${.TARGET}} ;;                             \
-       esac;                                                           \
+       ${RUN}${PRE_CMD.su-${.TARGET}:U${TRUE}};                        \
        if ${_IS_ROOT_CMD}; then                                        \
                ${_ROOT_CMD};                                           \
        else                                                            \



Home | Main Index | Thread Index | Old Index