diff options
author | jlam <jlam> | 2001-07-13 07:09:17 +0000 |
---|---|---|
committer | jlam <jlam> | 2001-07-13 07:09:17 +0000 |
commit | 03a6dd6fa68b8924591bf7640f135f0b395084b2 (patch) | |
tree | 6f97936deeb9a539bc07b5007be8c72a20640428 /security | |
parent | bb13b45fb37e28767db6b8129d33334a3c80e8ed (diff) | |
download | pkgsrc-03a6dd6fa68b8924591bf7640f135f0b395084b2.tar.gz |
In package Makefiles, create FILES_SUBST instead of duplicating sed
expression for substituting in DEINSTALL/INSTALL scripts. Use "${CMP} -s"
instead of "diff -q" since the former is more portable across OSes.
Diffstat (limited to 'security')
-rw-r--r-- | security/sudo/Makefile | 17 | ||||
-rw-r--r-- | security/sudo/pkg/DEINSTALL | 16 | ||||
-rwxr-xr-x | security/sudo/pkg/INSTALL | 19 |
3 files changed, 40 insertions, 12 deletions
diff --git a/security/sudo/Makefile b/security/sudo/Makefile index 539a3782195..7f6b08df2a2 100644 --- a/security/sudo/Makefile +++ b/security/sudo/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.36 2001/06/26 00:49:54 wiz Exp $ +# $NetBSD: Makefile,v 1.37 2001/07/13 07:09:23 jlam Exp $ # DISTNAME= sudo-1.6.3p7 @@ -38,6 +38,21 @@ PLIST_SRC+= ${PKGDIR}/PLIST.${LOWER_OPSYS} DOCDIR= ${PREFIX}/share/doc/sudo EGDIR= ${PREFIX}/share/examples/sudo +DEINSTALL_FILE= ${WRKDIR}/DEINSTALL +INSTALL_FILE= ${WRKDIR}/INSTALL + +FILES_SUBST= CAT=${CAT:Q} +FILES_SUBST+= CHMOD=${CHMOD:Q} +FILES_SUBST+= CHOWN=${CHOWN:Q} +FILES_SUBST+= CMP=${CMP:Q} +FILES_SUBST+= CP=${CP:Q} +FILES_SUBST+= RM=${RM:Q} +FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} + +pre-install: + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/INSTALL > ${INSTALL_FILE} + post-install: ${INSTALL_DATA_DIR} ${DOCDIR} ${INSTALL_DATA} ${WRKSRC}/UPGRADE ${DOCDIR} diff --git a/security/sudo/pkg/DEINSTALL b/security/sudo/pkg/DEINSTALL index 92722a32e51..c2986909560 100644 --- a/security/sudo/pkg/DEINSTALL +++ b/security/sudo/pkg/DEINSTALL @@ -1,10 +1,14 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.1 2000/12/06 06:33:40 jlam Exp $ +# $NetBSD: DEINSTALL,v 1.2 2001/07/13 07:09:23 jlam Exp $ PKGNAME=$1 STAGE=$2 +CAT="@CAT@" +CMP="@CMP@" +RM="@RM@" + SAMPLECONFDIR=${PKG_PREFIX}/share/examples/sudo CONFDIR=/etc CONFFILES="sudoers" @@ -18,12 +22,13 @@ DEINSTALL) do FILE=${CONFDIR}/${file} SAMPLEFILE=${SAMPLECONFDIR}/${file} - if diff -q ${FILE} ${SAMPLEFILE} >/dev/null + if ${CMP} -s ${FILE} ${SAMPLEFILE} then - rm -f ${FILE} + ${RM} -f ${FILE} fi done ;; + POST-DEINSTALL) modified_files='' for file in ${CONFFILES} @@ -36,7 +41,7 @@ POST-DEINSTALL) done if [ -n "${modified_files}" ] then - cat << EOF + ${CAT} << EOF =========================================================================== If you won't be using ${PKGNAME} any longer, you may want to remove the following files: @@ -46,11 +51,12 @@ EOF do echo " ${file}" done - cat << EOF + ${CAT} << EOF =========================================================================== EOF fi ;; + *) echo "Unexpected argument: ${STAGE}" exit 1 diff --git a/security/sudo/pkg/INSTALL b/security/sudo/pkg/INSTALL index f68c418762c..76d747ccc4a 100755 --- a/security/sudo/pkg/INSTALL +++ b/security/sudo/pkg/INSTALL @@ -1,10 +1,15 @@ #! /bin/sh # -# $NetBSD: INSTALL,v 1.3 2000/12/06 06:33:40 jlam Exp $ +# $NetBSD: INSTALL,v 1.4 2001/07/13 07:09:24 jlam Exp $ PKGNAME=$1 STAGE=$2 +CAT="@CAT@" +CHOWN="@CHOWN@" +CHMOD="@CHMOD@" +CP="@CP@" + SAMPLECONFDIR=${PKG_PREFIX}/share/examples/sudo CONFDIR=/etc CONFFILES="sudoers" @@ -12,6 +17,7 @@ CONFFILES="sudoers" case ${STAGE} in PRE-INSTALL) ;; + POST-INSTALL) echo "Installing configuration files:" for file in ${CONFFILES} @@ -23,12 +29,12 @@ POST-INSTALL) echo " ${FILE} already exists" else echo " ${FILE}" - cp ${SAMPLEFILE} ${FILE} - chown 0:0 ${FILE} - chmod 0440 ${FILE} + ${CP} ${SAMPLEFILE} ${FILE} + ${CHOWN} 0:0 ${FILE} + ${CHMOD} 0440 ${FILE} fi done - cat << EOF + ${CAT} << EOF =========================================================================== Some files you might need to customize include the following: @@ -38,10 +44,11 @@ EOF FILE=${CONFDIR}/${file} echo " ${FILE}" done - cat << EOF + ${CAT} << EOF =========================================================================== EOF ;; + *) echo "Unexpected argument: ${STAGE}" exit 1 |