diff options
author | jlam <jlam@pkgsrc.org> | 2007-07-12 19:41:46 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2007-07-12 19:41:46 +0000 |
commit | 83f1c3afae00e60c6926f11c9910249aae0b6858 (patch) | |
tree | 65d9ea88d837da23ad3b2a98c4094192d75dc2c4 /mk/pkginstall | |
parent | 8d79843561050fcb36e472ddb7fb6e125929fe41 (diff) | |
download | pkgsrc-83f1c3afae00e60c6926f11c9910249aae0b6858.tar.gz |
* Add a user-settable variable to tune the default verbosity of the
+INSTALL and +DEINSTALL scripts:
PKGINSTALL_VERBOSE
A list of scriptlets that will be verbose and output a message
noting the actions taken.
* "all" is a special value that implies all of the other items
* "fonts" for +FONTS
* "info-files" for +INFO_FILES
Default value: "all" for PKG_DEVELOPERs, empty otherwise.
* Be "one-liner brief" when doing the default actions. For example,
the info files output now looks like:
gmake-3.81: registering info file /usr/pkg/info/make.info
We retain the current verbosity for the CHECK-* actions.
Diffstat (limited to 'mk/pkginstall')
-rw-r--r-- | mk/pkginstall/bsd.pkginstall.mk | 30 | ||||
-rw-r--r-- | mk/pkginstall/files | 23 | ||||
-rw-r--r-- | mk/pkginstall/fonts | 28 | ||||
-rw-r--r-- | mk/pkginstall/info-files | 47 | ||||
-rw-r--r-- | mk/pkginstall/perms | 28 | ||||
-rw-r--r-- | mk/pkginstall/shell | 36 | ||||
-rw-r--r-- | mk/pkginstall/usergroupfuncs | 6 | ||||
-rw-r--r-- | mk/pkginstall/usergroupfuncs.DragonFly | 6 | ||||
-rw-r--r-- | mk/pkginstall/usergroupfuncs.FreeBSD | 6 | ||||
-rw-r--r-- | mk/pkginstall/usergroupfuncs.Linux | 6 |
10 files changed, 84 insertions, 132 deletions
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk index 026bbaa625e..c4272d9aef4 100644 --- a/mk/pkginstall/bsd.pkginstall.mk +++ b/mk/pkginstall/bsd.pkginstall.mk @@ -1,10 +1,22 @@ -# $NetBSD: bsd.pkginstall.mk,v 1.25 2007/06/15 22:04:33 jlam Exp $ +# $NetBSD: bsd.pkginstall.mk,v 1.26 2007/07/12 19:41:46 jlam Exp $ # # This Makefile fragment is included by bsd.pkg.mk and implements the # common INSTALL/DEINSTALL scripts framework. To use the pkginstall # framework, simply set the relevant variables to customize the install # scripts to the package. # +# User-settable variables: +# +# PKGINSTALL_VERBOSE +# A list of scriptlets that will be verbose and output a message +# noting the actions taken. +# +# * "all" is a special value that implies all of the other items +# * "fonts" for +FONTS +# * "info-files" for +INFO_FILES +# +# Default value: "all" for PKG_DEVELOPERs, empty otherwise. +# # The Solaris /bin/sh does not know the ${foo#bar} shell substitution. # This shell function serves a similar purpose, but is specialized on @@ -809,6 +821,22 @@ FILES_SUBST+= PKG_RCD_SCRIPTS=${PKG_RCD_SCRIPTS:Q} FILES_SUBST+= PKG_REGISTER_SHELLS=${PKG_REGISTER_SHELLS:Q} FILES_SUBST+= PKG_UPDATE_FONTS_DB=${PKG_UPDATE_FONTS_DB:Q} +.if defined(PKG_DEVELOPER) +PKGINSTALL_VERBOSE?= all +.else +PKGINSTALL_VERBOSE?= # empty +.endif +.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Mfonts) +FILES_SUBST+= FONTS_VERBOSE=yes +.else +FILES_SUBST+= FONTS_VERBOSE=no +.endif +.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Minfo-files) +FILES_SUBST+= INFO_FILES_VERBOSE=yes +.else +FILES_SUBST+= INFO_FILES_VERBOSE=no +.endif + # Substitute for various programs used in the DEINSTALL/INSTALL scripts and # in the rc.d scripts. # diff --git a/mk/pkginstall/files b/mk/pkginstall/files index 8571577a4d8..61a3ff6715d 100644 --- a/mk/pkginstall/files +++ b/mk/pkginstall/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.3 2006/12/15 13:15:06 martti Exp $ +# $NetBSD: files,v 1.4 2007/07/12 19:41:46 jlam Exp $ # # Generate a +FILES script that reference counts config files that are # required for the proper functioning of the package. @@ -118,7 +118,7 @@ exitcode=0 case $ACTION in ADD) ${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -u | - { while read file f_flags f_eg f_mode f_user f_group; do + while read file f_flags f_eg f_mode f_user f_group; do case $file in "") continue ;; [!/]*) file="${PKG_PREFIX}/$file" ;; @@ -157,20 +157,10 @@ ADD) else case "$f_flags:$_PKG_CONFIG:$_PKG_RCD_SCRIPTS" in *f*:*:*|[!r]:yes:*|[!r][!r]:yes:*|[!r][!r][!r]:yes:*|*r*:yes:yes) - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Installing files needed by ${PKGNAME}:" - ;; - esac if ${TEST} -f "$file"; then - ${ECHO} "" - ${ECHO} " $file already exists." + ${ECHO} "${PKGNAME}: $file already exists" elif ${TEST} -f "$f_eg"; then - ${ECHO} "" - ${ECHO} " $file" - ${ECHO} " [$f_eg]" + ${ECHO} "${PKGNAME}: copying $f_eg to $file" ${CP} $f_eg $file case $f_user in "") ;; @@ -189,11 +179,6 @@ ADD) esac fi done - case "$printed_header" in - yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; - esac; } ;; REMOVE) diff --git a/mk/pkginstall/fonts b/mk/pkginstall/fonts index f205a68808d..76b676711b5 100644 --- a/mk/pkginstall/fonts +++ b/mk/pkginstall/fonts @@ -1,4 +1,4 @@ -# $NetBSD: fonts,v 1.4 2007/01/02 11:47:26 joerg Exp $ +# $NetBSD: fonts,v 1.5 2007/07/12 19:41:46 jlam Exp $ # # Generate a +FONTS script that updates font databases for the package. # @@ -56,8 +56,17 @@ case "${PKG_UPDATE_FONTS_DB:-@PKG_UPDATE_FONTS_DB@}" in ;; esac +case "${FONTS_VERBOSE:-@FONTS_VERBOSE@}" in +[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + echo="${ECHO}" + ;; +[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + echo=":" + ;; +esac + ${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u | -{ while read dir font_type; do +while read dir font_type; do case ${_PKG_UPDATE_FONTS_DB} in no) continue ;; esac @@ -66,15 +75,7 @@ ${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u | [!/]*) dir="${PKG_PREFIX}/$dir" ;; esac ${TEST} -d "$dir" || continue - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Updating font databases in the following directories:" - ${ECHO} "" - ;; - esac - ( ${ECHO} " $dir ($font_type)" + ( $echo "${PKGNAME}: updating font database in $dir ($font_type)" cd $dir update_args= post_update_cmd= @@ -96,11 +97,6 @@ ${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u | ${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\.scale" | ${GREP} -v "/fonts\.dir" | ${GREP} -v "/Fontmap" >/dev/null || ${RM} -f fonts.dir fonts.scale Fontmap* encodings.dir > /dev/null ) done -case "$printed_header" in -yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; -esac; } EOF ${SED} -n "/^\# FONTS: /p" ${SELF} >> ./+FONTS diff --git a/mk/pkginstall/info-files b/mk/pkginstall/info-files index fec0215f359..090fe1e5b1c 100644 --- a/mk/pkginstall/info-files +++ b/mk/pkginstall/info-files @@ -1,4 +1,4 @@ -# $NetBSD: info-files,v 1.3 2006/12/29 07:06:31 obache Exp $ +# $NetBSD: info-files,v 1.4 2007/07/12 19:41:46 jlam Exp $ # # Generate an +INFO_FILES script that handles info file registration for # the package. @@ -48,11 +48,20 @@ PKG_METADATA_DIR="${2-${CURDIR}}" : ${PKGNAME=${PKG_METADATA_DIR##*/}} : ${PKG_PREFIX=@PREFIX@} +case "${INFO_FILES_VERBOSE:-@INFO_FILES_VERBOSE@}" in +[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + echo="${ECHO}" + ;; +[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + echo=":" + ;; +esac + exitcode=0 case $ACTION in ADD) ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u | - { while read file infodir; do + while read file infodir; do case $file in "") continue ;; [!/]*) file="${PKG_PREFIX}/$file" ;; @@ -61,15 +70,6 @@ ADD) if ${TEST} ! -f "$file"; then : else - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Registering info files for ${PKGNAME}:" - ${ECHO} "" - ;; - esac - case $infodir in "") infodir="${file%/*}" ;; [!/]*) infodir="${PKG_PREFIX}/$infodir" ;; @@ -79,22 +79,17 @@ ADD) case "$nentries" in [0-9]*) ${TEST} $nentries -gt 0 || ${RM} $infoindex ;; esac - ${ECHO} " $file" + $echo "${PKGNAME}: registering info file $file" ${MKDIR} -p "$infodir" ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1 ${INSTALL_INFO} --info-dir="$infodir" $file >/dev/null 2>&1 fi done - case "$printed_header" in - yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; - esac; } ;; REMOVE) ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u | - { while read file infodir; do + while read file infodir; do case $file in "") continue ;; [!/]*) file="${PKG_PREFIX}/$file" ;; @@ -103,21 +98,12 @@ REMOVE) if ${TEST} ! -f "$file"; then : else - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Unregistering info files for ${PKGNAME}:" - ${ECHO} "" - ;; - esac - case $infodir in "") infodir="${file%/*}" ;; [!/]*) infodir="${PKG_PREFIX}/$infodir" ;; esac infoindex="$infodir/dir" - ${ECHO} " $file" + $echo "${PKGNAME}: unregistering info file $file" ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1 nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`" case "$nentries" in @@ -126,11 +112,6 @@ REMOVE) ${RMDIR} -p "$infodir" 2>/dev/null || ${TRUE} fi done - case "$printed_header" in - yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; - esac; } ;; esac exit $exitcode diff --git a/mk/pkginstall/perms b/mk/pkginstall/perms index c6c895b8a6b..af84b202969 100644 --- a/mk/pkginstall/perms +++ b/mk/pkginstall/perms @@ -1,4 +1,4 @@ -# $NetBSD: perms,v 1.2 2006/07/19 22:26:26 jlam Exp $ +# $NetBSD: perms,v 1.3 2007/07/12 19:41:46 jlam Exp $ # # Generate a +PERMS script that sets the special permissions on files # and directories used by the package. @@ -42,35 +42,28 @@ PKG_METADATA_DIR="${1-${CURDIR}}" : ${PKG_PREFIX=@PREFIX@} ${SED} -n "/^\# PERMS: /{s/^\# PERMS: //;p;}" ${SELF} | ${SORT} -u | -{ while read file f_mode f_user f_group; do +while read file f_mode f_user f_group; do case $file in "") continue ;; [!/]*) file="${PKG_PREFIX}/$file" ;; esac ${TEST} -f "$file" || continue - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "The following files and directories needed by ${PKGNAME}" - ${ECHO} "have special permissions:" - ${ECHO} "" - ;; - esac + filemsg= case $f_mode/$f_user/$f_group in //) - ${ECHO} " $file" + filemsg="$file" ;; [!/]*//) - ${ECHO} " $file (m=$f_mode)" + filemsg="$file (m=$f_mode)" ;; [!/]*/[!/]*/) - ${ECHO} " $file (o=$f_user, m=$f_mode)" + filemsg="$file (o=$f_user, m=$f_mode)" ;; [!/]*/[!/]*/[!/]*) - ${ECHO} " $file (o=$f_user, g=$f_group, m=$f_mode)" + filemsg="$file (o=$f_user, g=$f_group, m=$f_mode)" ;; esac + ${ECHO} "${PKGNAME}: setting permissions on $filemsg" case $f_user in "") ;; *) ${CHOWN} $f_user $file ;; @@ -84,11 +77,6 @@ ${SED} -n "/^\# PERMS: /{s/^\# PERMS: //;p;}" ${SELF} | ${SORT} -u | *) ${CHMOD} $f_mode $file ;; esac done -case "$printed_header" in -yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; -esac; } EOF ${SED} -n "/^\# PERMS: /p" ${SELF} >> ./+PERMS diff --git a/mk/pkginstall/shell b/mk/pkginstall/shell index 9a99613bb14..b46b07ffdb1 100644 --- a/mk/pkginstall/shell +++ b/mk/pkginstall/shell @@ -1,4 +1,4 @@ -# $NetBSD: shell,v 1.3 2006/07/19 22:26:26 jlam Exp $ +# $NetBSD: shell,v 1.4 2007/07/12 19:41:46 jlam Exp $ # # Generate a +SHELL script that handles shell registration for the package. # @@ -62,7 +62,7 @@ exitcode=0 case $ACTION in ADD) ${SED} -n "/^\# SHELL: /{s/^\# SHELL: //;p;}" ${SELF} | ${SORT} -u | - { while read shell; do + while read shell; do case ${_PKG_REGISTER_SHELLS} in no) continue ;; esac @@ -82,31 +82,18 @@ ADD) ${GREP} "^$shell" $shelldb >/dev/null; then : else - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Adding ${PKGNAME} shells to $shelldb:" - ${ECHO} "" - ;; - esac - ${ECHO} " $shell" + ${ECHO} "${PKGNAME}: adding $shell to $shelldb" ${TOUCH} $shelldb ${CP} $shelldb $shelldb.pkgsrc."$$" { ${CAT} $shelldb.pkgsrc."$$"; ${ECHO} "$shell"; } > $shelldb ${RM} $shelldb.pkgsrc."$$" fi done - case "$printed_header" in - yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; - esac; } ;; REMOVE) ${SED} -n "/^\# SHELL: /{s/^\# SHELL: //;p;}" ${SELF} | ${SORT} -u | - { while read shell; do + while read shell; do case ${_PKG_REGISTER_SHELLS} in no) continue ;; esac @@ -123,26 +110,13 @@ REMOVE) shelldb="/etc/shells" if ${TEST} -f "$shelldb" && \ ${GREP} "^$shell" $shelldb >/dev/null; then - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "Removing ${PKGNAME} shells from $shelldb:" - ${ECHO} "" - ;; - esac - ${ECHO} " $shell" + ${ECHO} "${PKGNAME}: removing $shell from $shelldb" ${TOUCH} $shelldb ${CP} $shelldb $shelldb.pkgsrc."$$" { ${GREP} -v "^$shell" $shelldb.pkgsrc."$$" || ${TRUE}; } > $shelldb ${RM} $shelldb.pkgsrc."$$" fi done - case "$printed_header" in - yes) ${ECHO} "" - ${ECHO} "===========================================================================" - ;; - esac; } ;; CHECK-ADD) diff --git a/mk/pkginstall/usergroupfuncs b/mk/pkginstall/usergroupfuncs index c0bab9b31ee..ed40f024611 100644 --- a/mk/pkginstall/usergroupfuncs +++ b/mk/pkginstall/usergroupfuncs @@ -1,4 +1,4 @@ -# $NetBSD: usergroupfuncs,v 1.2 2006/12/15 13:15:06 martti Exp $ +# $NetBSD: usergroupfuncs,v 1.3 2007/07/12 19:41:46 jlam Exp $ # # Default implementations of user_exists() and group_exists() shell # functions for checking the existence of users and groups, and of @@ -111,7 +111,7 @@ adduser() : ${shell:="@PKG_USER_SHELL@"} if ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then - ${ECHO} "Creating user: $user" + ${ECHO} "${PKGNAME}: Creating user \`\`$user''" case $userid in "") ${USERADD} \ @@ -138,7 +138,7 @@ addgroup() GROUPADD="@GROUPADD@" if ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then - ${ECHO} "Creating group: $group"; + ${ECHO} "${PKGNAME}: Creating group \`\`$group''" case $groupid in "") ${GROUPADD} $group ;; *) ${GROUPADD} -g $groupid $group ;; diff --git a/mk/pkginstall/usergroupfuncs.DragonFly b/mk/pkginstall/usergroupfuncs.DragonFly index 39579bd49e2..78aaa3f24ee 100644 --- a/mk/pkginstall/usergroupfuncs.DragonFly +++ b/mk/pkginstall/usergroupfuncs.DragonFly @@ -1,4 +1,4 @@ -# $NetBSD: usergroupfuncs.DragonFly,v 1.2 2006/12/15 13:15:06 martti Exp $ +# $NetBSD: usergroupfuncs.DragonFly,v 1.3 2007/07/12 19:41:46 jlam Exp $ # # Platform-specific adduser and addgroup functionality # on top of pw(8). @@ -103,7 +103,7 @@ adduser() : ${shell:="@PKG_USER_SHELL@"} if ${TEST} -n "${PW}" -a -x "${PW}"; then - ${ECHO} "Creating user: $user" + ${ECHO} "${PKGNAME}: Creating user \`\`$user''" case $userid in "") ${PW} useradd \ @@ -132,7 +132,7 @@ addgroup() PW="@PW@" if ${TEST} -n "${PW}" -a -x "${PW}"; then - ${ECHO} "Creating group: $group"; + ${ECHO} "${PKGNAME}: Creating group \`\`$group''" case $groupid in "") ${PW} groupadd $group ;; *) ${PW} groupadd $group -g $groupid ;; diff --git a/mk/pkginstall/usergroupfuncs.FreeBSD b/mk/pkginstall/usergroupfuncs.FreeBSD index 111c915c6f1..9454bc37a95 100644 --- a/mk/pkginstall/usergroupfuncs.FreeBSD +++ b/mk/pkginstall/usergroupfuncs.FreeBSD @@ -1,4 +1,4 @@ -# $NetBSD: usergroupfuncs.FreeBSD,v 1.2 2006/12/15 13:15:06 martti Exp $ +# $NetBSD: usergroupfuncs.FreeBSD,v 1.3 2007/07/12 19:41:46 jlam Exp $ # # Platform-specific adduser and addgroup functionality # on top of pw(8). @@ -103,7 +103,7 @@ adduser() : ${shell:="@PKG_USER_SHELL@"} if ${TEST} -n "${PW}" -a -x "${PW}"; then - ${ECHO} "Creating user: $user" + ${ECHO} "${PKGNAME}: Creating user \`\`$user''" case $userid in "") ${PW} useradd \ @@ -132,7 +132,7 @@ addgroup() PW="@PW@" if ${TEST} -n "${PW}" -a -x "${PW}"; then - ${ECHO} "Creating group: $group"; + ${ECHO} "${PKGNAME}: Creating group \`\`$group''" case $groupid in "") ${PW} groupadd $group ;; *) ${PW} groupadd $group -g $groupid ;; diff --git a/mk/pkginstall/usergroupfuncs.Linux b/mk/pkginstall/usergroupfuncs.Linux index bdbd3cfc3c6..29e8d31261f 100644 --- a/mk/pkginstall/usergroupfuncs.Linux +++ b/mk/pkginstall/usergroupfuncs.Linux @@ -1,4 +1,4 @@ -# $NetBSD: usergroupfuncs.Linux,v 1.2 2006/12/15 13:15:06 martti Exp $ +# $NetBSD: usergroupfuncs.Linux,v 1.3 2007/07/12 19:41:46 jlam Exp $ # # Platform-specific adduser and addgroup functionality # on top of shadow-utils. (Not libuser) @@ -103,7 +103,7 @@ adduser() : ${shell:="@PKG_USER_SHELL@"} if ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then - ${ECHO} "Creating user: $user" + ${ECHO} "${PKGNAME}: Creating user \`\`$user''" # if home directory is missing, make and remove it # ensures that the base directory exists, for shadow-utils if ! ${TEST} -d "$home"; then @@ -136,7 +136,7 @@ addgroup() GROUPADD="@GROUPADD@" if ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then - ${ECHO} "Creating group: $group"; + ${ECHO} "${PKGNAME}: Creating group \`\`$group''" case $groupid in "") ${GROUPADD} $group ;; *) ${GROUPADD} -g $groupid $group ;; |