diff options
author | kim <kim> | 2001-05-13 19:02:47 +0000 |
---|---|---|
committer | kim <kim> | 2001-05-13 19:02:47 +0000 |
commit | 5b8a685062aaa8a09ac35dfecb9736b774e48315 (patch) | |
tree | 429f37d6aba1cbbb9c4691a3e4e33dcdbb1dcc97 /net/vtun | |
parent | 5b35ff52459bb0804b85c6a3da6d3183f91aa5cc (diff) | |
download | pkgsrc-5b8a685062aaa8a09ac35dfecb9736b774e48315.tar.gz |
The config file for vtun is machine specific, so make it possible to
place it in /etc using VTUN_SYSCONFDIR.
Diffstat (limited to 'net/vtun')
-rw-r--r-- | net/vtun/Makefile | 38 | ||||
-rw-r--r-- | net/vtun/pkg/DEINSTALL | 99 | ||||
-rw-r--r-- | net/vtun/pkg/INSTALL | 62 | ||||
-rw-r--r-- | net/vtun/pkg/PLIST | 6 |
4 files changed, 201 insertions, 4 deletions
diff --git a/net/vtun/Makefile b/net/vtun/Makefile index df2ed0d3f79..2ab9cf17dec 100644 --- a/net/vtun/Makefile +++ b/net/vtun/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2001/03/08 10:24:20 wiz Exp $ +# $NetBSD: Makefile,v 1.10 2001/05/13 19:02:47 kim Exp $ DISTNAME= vtun-2.4 CATEGORIES= net @@ -22,4 +22,40 @@ CONFIGURE_ENV+= LIBS="${LIBS}" ALL_TARGET= vtund PLIST_SUBST+= PREFIX=${PREFIX} +DEINSTALL_FILE= ${WRKDIR}/DEINSTALL +INSTALL_FILE= ${WRKDIR}/INSTALL + +.include "../../mk/bsd.prefs.mk" + +VTUN_SYSCONFDIR?=${LOCALBASE}/etc +CONFIGURE_ARGS+=--sysconfdir=${VTUN_SYSCONFDIR} +BUILD_DEFS+= VTUN_SYSCONFDIR + +pre-install: + @${SED} -e "s|@CAT@|${CAT}|g" \ + -e "s|@RM@|${RM}|g" \ + -e "s|@RMDIR@|${RMDIR}|g" \ + -e "s|@TRUE@|${TRUE}|g" \ + -e "s|@VTUN_SYSCONFDIR@|${VTUN_SYSCONFDIR}|g" \ + ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + @${SED} -e "s|@CAT@|${CAT}|g" \ + -e "s|@CHMOD@|${CHMOD}|g" \ + -e "s|@CP@|${CP}|g" \ + -e "s|@MKDIR@|${MKDIR}|g" \ + -e "s|@VTUN_SYSCONFDIR@|${VTUN_SYSCONFDIR}|g" \ + ${PKGDIR}/INSTALL > ${INSTALL_FILE} + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/vtund ${PREFIX}/sbin + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/vtun + ${INSTALL_DATA} ${WRKSRC}/vtund.conf \ + ${PREFIX}/share/examples/vtun/vtund.conf.example + ${INSTALL_MAN} ${WRKSRC}/vtund.conf.5 ${PREFIX}/man/man5 + ${INSTALL_MAN} ${WRKSRC}/vtund.8 ${PREFIX}/man/man8 + ${RM} -f ${PREFIX}/man/man8/vtun.8 + ${LN} -s vtund.8 ${PREFIX}/man/man8/vtun.8 + +post-install: + @PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL + .include "../../mk/bsd.pkg.mk" diff --git a/net/vtun/pkg/DEINSTALL b/net/vtun/pkg/DEINSTALL new file mode 100644 index 00000000000..a4e741db4a1 --- /dev/null +++ b/net/vtun/pkg/DEINSTALL @@ -0,0 +1,99 @@ +#!/bin/sh +# +# $NetBSD: DEINSTALL,v 1.1 2001/05/13 19:02:48 kim Exp $ + +PKGNAME=$1 +STAGE=$2 + +CAT="@CAT@" +RM="@RM@" +RMDIR="@RMDIR@" +TRUE="@TRUE@" + +CONFDIR="@VTUN_SYSCONFDIR@" +SAMPLECONFDIR=${PKG_PREFIX}/share/examples/vtun +CONFFILES="vtund.conf" +LOCKDIR=/var/lock/vtund +LOGDIR=/var/log/vtund + +case ${STAGE} in +DEINSTALL) + # Remove configuration files if they don't differ from the default + # config file. + # + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + SAMPLEFILE=${SAMPLECONFDIR}/${file}.example + if diff -q ${FILE} ${SAMPLEFILE} >/dev/null + then + ${RM} -f ${FILE} + fi + done + ;; + +POST-DEINSTALL) + modified_files='' + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + if [ -f ${FILE} ] + then + modified_files="${modified_files} ${FILE}" + fi + done + + ${RMDIR} ${LOCKDIR} 2>/dev/null || ${TRUE} + ${RMDIR} ${LOGDIR} 2>/dev/null || ${TRUE} + + existing_dirs='' + for dir in ${LOCKDIR} ${LOGDIR} + do + if [ -d ${dir} ] + then + existing_dirs="${existing_dirs} ${dir}" + fi + done + + if [ -n "${modified_files}" -o -n "${existing_dirs}" ] + then + ${CAT} << EOF +=========================================================================== +If you won't be using ${PKGNAME} any longer, you may want to remove: +EOF + if [ -n "${modified_files}" ] + then + ${CAT} << EOF + + * the following files: + +EOF + for file in ${modified_files} + do + echo " ${file}" + done + fi + if [ -n "${existing_dirs}" ] + then + ${CAT} << EOF + + * the following directories: + +EOF + for dir in ${existing_dirs} + do + echo " ${dir}" + done + fi + ${CAT} << EOF +=========================================================================== +EOF + fi + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac +exit 0 diff --git a/net/vtun/pkg/INSTALL b/net/vtun/pkg/INSTALL new file mode 100644 index 00000000000..3b6f490bddf --- /dev/null +++ b/net/vtun/pkg/INSTALL @@ -0,0 +1,62 @@ +#!/bin/sh +# +# $NetBSD: INSTALL,v 1.1 2001/05/13 19:02:48 kim Exp $ + +PKGNAME=$1 +STAGE=$2 + +CAT="@CAT@" +CHMOD="@CHMOD@" +CP="@CP@" +MKDIR="@MKDIR@" + +CONFDIR="@VTUN_SYSCONFDIR@" +SAMPLECONFDIR=${PKG_PREFIX}/share/examples/vtun +CONFFILES="vtund.conf" +LOCKDIR=/var/lock/vtund +LOGDIR=/var/log/vtund + +case ${STAGE} in +PRE-INSTALL) + ;; + +POST-INSTALL) + ${MKDIR} ${LOCKDIR} + ${MKDIR} ${LOGDIR} + + echo "Installing configuration files:" + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + SAMPLEFILE=${SAMPLECONFDIR}/${file}.example + if [ -f ${FILE} ] + then + echo " ${FILE} already exists" + else + echo " ${FILE}" + ${CP} ${SAMPLEFILE} ${FILE} + ${CHMOD} 644 ${FILE} + fi + done + ${CAT} << EOF + +=========================================================================== +Some files you might need to customize include the following: + +EOF + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + echo " ${FILE}" + done + ${CAT} << EOF +=========================================================================== +EOF + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac +exit 0 diff --git a/net/vtun/pkg/PLIST b/net/vtun/pkg/PLIST index 0ed5de6deaa..4144d572c88 100644 --- a/net/vtun/pkg/PLIST +++ b/net/vtun/pkg/PLIST @@ -1,7 +1,7 @@ -@comment $NetBSD: PLIST,v 1.2 2000/06/06 07:21:47 kleink Exp $ +@comment $NetBSD: PLIST,v 1.3 2001/05/13 19:02:48 kim Exp $ sbin/vtund -etc/vtund.conf.example -@exec if [ ! -f ${PREFIX}/etc/vtund.conf ]; then echo "Installing example /vtund.conf in ${PREFIX}/etc ..." ; /usr/bin/install -c -o root -g wheel -m 0600 %D/etc/vtund.conf.example ${PREFIX}/etc/vtund.conf ; fi +share/examples/vtun/vtund.conf.example man/man5/vtund.conf.5 man/man8/vtund.8 man/man8/vtun.8 +@dirrm share/examples/vtun |