From 034112c3cd546b0fc415692a8e398e024d9075ed Mon Sep 17 00:00:00 2001 From: jlam Date: Fri, 28 Sep 2001 08:54:56 +0000 Subject: Copy some of the code from xpkgwedge's DEINSTALL/INSTALL scripts so that if ${PREFIX}/lib/X11/config/host.def doesn't exist, it will be created correctly nonetheless. --- x11/openmotif/Makefile | 3 ++- x11/openmotif/pkg/DEINSTALL | 20 ++++++++++++++------ x11/openmotif/pkg/INSTALL | 28 +++++++++++++++++++++------- 3 files changed, 37 insertions(+), 14 deletions(-) (limited to 'x11/openmotif') diff --git a/x11/openmotif/Makefile b/x11/openmotif/Makefile index 9498262e5f1..2a413f9fa98 100644 --- a/x11/openmotif/Makefile +++ b/x11/openmotif/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2001/09/27 23:19:01 jlam Exp $ +# $NetBSD: Makefile,v 1.10 2001/09/28 08:54:56 jlam Exp $ # FreeBSD: /c/ncvs/ports/x11-toolkits/open-motif/Makefile,v 1.18 2000/10/09 01:40:02 asami Exp # OpenBSD: Makefile,v 1.5 2000/10/23 16:08:12 espie Exp @@ -32,6 +32,7 @@ INSTALL_FILE= ${WRKDIR}/INSTALL FILES_SUBST= X11BASE=${X11BASE} FILES_SUBST+= CP=${CP:Q} +FILES_SUBST+= CMP=${CMP:Q} FILES_SUBST+= ECHO=${ECHO:Q} FILES_SUBST+= GREP=${GREP:Q} FILES_SUBST+= LN=${LN:Q} diff --git a/x11/openmotif/pkg/DEINSTALL b/x11/openmotif/pkg/DEINSTALL index b17255972eb..6689e2f4fb7 100644 --- a/x11/openmotif/pkg/DEINSTALL +++ b/x11/openmotif/pkg/DEINSTALL @@ -1,11 +1,12 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.1 2001/09/08 20:03:45 jlam Exp $ +# $NetBSD: DEINSTALL,v 1.2 2001/09/28 08:54:56 jlam Exp $ PKGNAME=$1 STAGE=$2 CP="@CP@" +CMP="@CMP@" ECHO="@ECHO@" GREP="@GREP@" MV="@MV@" @@ -16,17 +17,24 @@ TRUE="@TRUE@" X11BASE=@X11BASE@ MOTIF_RULES=${PKG_PREFIX}/lib/X11/config/Motif.rules MOTIF_TMPL=${PKG_PREFIX}/lib/X11/config/Motif.tmpl -X11_HOSTDEF=${PKG_PREFIX}/lib/X11/config/host.def +X11_HOSTDEF=${X11BASE}/lib/X11/config/host.def +HOSTDEF=${PKG_PREFIX}/lib/X11/config/host.def case ${STAGE} in DEINSTALL) ;; POST-DEINSTALL) - ${ECHO} -n "Updating ${X11_HOSTDEF}..." - ${CP} -f ${X11_HOSTDEF} ${X11_HOSTDEF}.bak - ( ${GREP} -v OpenMotif ${X11_HOSTDEF}.bak || ${TRUE} ) \ - > ${X11_HOSTDEF} + ${ECHO} -n "Updating ${HOSTDEF}..." + ${CP} -f ${HOSTDEF} ${HOSTDEF}.bak + ( ${GREP} -v OpenMotif ${HOSTDEF}.bak || ${TRUE} ) > ${HOSTDEF} + ${RM} -f ${HOSTDEF}.bak + if [ ${PKG_PREFIX} != ${X11BASE} ] && \ + [ -f ${X11_HOSTDEF} ] && \ + ${CMP} -s ${X11_HOSTDEF} ${HOSTDEF} + then + ${RM} -f ${HOSTDEF} + fi ${ECHO} "done." ${RM} -f ${MOTIF_RULES} ${MOTIF_TMPL} diff --git a/x11/openmotif/pkg/INSTALL b/x11/openmotif/pkg/INSTALL index 6e675d16a54..97aa953de3b 100644 --- a/x11/openmotif/pkg/INSTALL +++ b/x11/openmotif/pkg/INSTALL @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.1 2001/09/08 20:03:45 jlam Exp $ +# $NetBSD: INSTALL,v 1.2 2001/09/28 08:54:56 jlam Exp $ PKGNAME=$1 STAGE=$2 @@ -10,11 +10,13 @@ ECHO="@ECHO@" GREP="@GREP@" LN="@LN@" MV="@MV@" +RM="@RM@" X11BASE=@X11BASE@ MOTIF_RULES=${PKG_PREFIX}/lib/X11/config/Motif.rules MOTIF_TMPL=${PKG_PREFIX}/lib/X11/config/Motif.tmpl -X11_HOSTDEF=${PKG_PREFIX}/lib/X11/config/host.def +X11_HOSTDEF=${X11BASE}/lib/X11/config/host.def +HOSTDEF=${PKG_PREFIX}/lib/X11/config/host.def case ${STAGE} in PRE-INSTALL) @@ -29,11 +31,23 @@ POST-INSTALL) ${LN} -sf OpenMotif.rules ${MOTIF_RULES} ${LN} -sf OpenMotif.tmpl ${MOTIF_TMPL} - ${ECHO} -n "Updating ${X11_HOSTDEF}..." - ${CP} -f ${X11_HOSTDEF} ${X11_HOSTDEF}.bak - ( ${GREP} -v OpenMotif ${X11_HOSTDEF}.bak; \ - ${ECHO} '#include ' ) \ - > ${X11_HOSTDEF} + if [ ${PKG_PREFIX} = ${X11BASE} -o -f ${HOSTDEF} ] + then + ${ECHO} -n "Updating ${HOSTDEF}..." + ${CP} -f ${HOSTDEF} ${HOSTDEF}.bak + else + ${ECHO} -n "Creating ${HOSTDEF}..." + if [ -f ${X11_HOSTDEF} ] + then + ${CP} -f ${X11_HOSTDEF} ${HOSTDEF}.bak + else + ${CP} -f /dev/null ${HOSTDEF}.bak + fi + fi + ( ${GREP} -v OpenMotif ${HOSTDEF}.bak; \ + ${ECHO} '#include '; \ + ) > ${HOSTDEF} + ${RM} -f ${HOSTDEF}.bak ${ECHO} "done." ;; -- cgit v1.2.3