diff options
author | lukem <lukem@pkgsrc.org> | 2001-11-19 04:25:15 +0000 |
---|---|---|
committer | lukem <lukem@pkgsrc.org> | 2001-11-19 04:25:15 +0000 |
commit | 3730441d5d078872bb29db63ad6ae546a7bba9d7 (patch) | |
tree | cf833b9585cbfc9bd64fcda42808cda634d1e602 /sysutils/ups-nut | |
parent | 409928b75a64da5b12130c71de56122856ea2f15 (diff) | |
download | pkgsrc-3730441d5d078872bb29db63ad6ae546a7bba9d7.tar.gz |
cleanup (inspired by ../../databases/postgresql-server):
- use FILES_SUBST_SED mechanism
- do NOT remove user & group upon DEINSTALL; instead remind the admin to do it
Diffstat (limited to 'sysutils/ups-nut')
-rw-r--r-- | sysutils/ups-nut/DEINSTALL | 36 | ||||
-rw-r--r-- | sysutils/ups-nut/INSTALL | 73 | ||||
-rw-r--r-- | sysutils/ups-nut/Makefile | 41 |
3 files changed, 88 insertions, 62 deletions
diff --git a/sysutils/ups-nut/DEINSTALL b/sysutils/ups-nut/DEINSTALL index 05d5b7366af..6f6cde628a6 100644 --- a/sysutils/ups-nut/DEINSTALL +++ b/sysutils/ups-nut/DEINSTALL @@ -1,19 +1,35 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.1 2001/10/31 22:54:04 zuntum Exp $ +# $NetBSD: DEINSTALL,v 1.2 2001/11/19 04:25:15 lukem Exp $ # +PKGNAME=$1 +STAGE=$2 + USER="@NUT_USER@" GROUP="@NUT_GROUP@" -USERDEL="@USERDEL@" -GROUPDEL="@GROUPDEL@" - -case "$2" in - DEINSTALL) - echo "Removing user ${USER}" - ${USERDEL} -r ${USER} - echo "Removing group ${GROUP}" - ${GROUPDEL} ${GROUP} + +CAT="@CAT@" + +case ${STAGE} in +DEINSTALL) + ;; + +POST-DEINSTALL) + ${CAT} << EOF +=========================================================================== +If you won't be using ${PKGNAME} any longer, you may want to remove: + + * the \`${USER}' user + * the \`${GROUP}' group + +=========================================================================== +EOF + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 ;; esac exit 0 diff --git a/sysutils/ups-nut/INSTALL b/sysutils/ups-nut/INSTALL index d2b1a1937ce..ad4011fb974 100644 --- a/sysutils/ups-nut/INSTALL +++ b/sysutils/ups-nut/INSTALL @@ -1,6 +1,9 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.1 2001/10/31 22:54:04 zuntum Exp $ +# $NetBSD: INSTALL,v 1.2 2001/11/19 04:25:15 lukem Exp $ + +PKGNAME=$1 +STAGE=$2 USER=@NUT_USER@ GROUP=@NUT_GROUP@ @@ -12,33 +15,45 @@ ID="@ID@" RM="@RM@" TOUCH="@TOUCH@" -# Group... the default's shipped with NetBSD -# We need to check that ${GROUP} exists before adding the user. -# Do it with chgrp to be able to use NIS. -# -${TOUCH} "/tmp/grouptest.$$" -${CHGRP} ${GROUP} "/tmp/grouptest.$$" >/dev/null 2>&1 -if [ $? -eq 0 ] -then - echo "Group '${GROUP}' already exists...proceeding." -else - echo "Creating '${GROUP}' group..." - ${ADDGROUP} ${GROUP} - echo "Done." -fi -${RM} -f "/tmp/grouptest.$$" +case ${STAGE} in +PRE-INSTALL) + # Group... the default's shipped with NetBSD + # We need to check that ${GROUP} exists before adding the user. + # Do it with chgrp to be able to use NIS. + # + ${TOUCH} "/tmp/grouptest.$$" + ${CHGRP} ${GROUP} "/tmp/grouptest.$$" >/dev/null 2>&1 + if [ $? -eq 0 ] + then + echo "Group '${GROUP}' already exists...proceeding." + else + echo "Creating '${GROUP}' group..." + ${ADDGROUP} ${GROUP} + echo "Done." + fi + ${RM} -f "/tmp/grouptest.$$" -# Use `id' to be able to use NIS. -# -${ID} ${USER} 2>/dev/null >/dev/null -if [ $? -eq 0 ] -then - echo "User '${USER}' already exists...proceeding." -else - echo "Creating '${USER}' user..." - ${ADDUSER} \ - -c "Network UPS Tools" \ - -g ${GROUP} -s /bin/sh -m ${USER} - echo "Done." -fi + # Use `id' to be able to use NIS. + # + ${ID} ${USER} 2>/dev/null >/dev/null + if [ $? -eq 0 ] + then + echo "User '${USER}' already exists...proceeding." + else + echo "Creating '${USER}' user..." + ${ADDUSER} \ + -c "Network UPS Tools" \ + -g ${GROUP} -s /bin/sh -m ${USER} + echo "Done." + fi + ;; + +POST-INSTALL) + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac exit 0 diff --git a/sysutils/ups-nut/Makefile b/sysutils/ups-nut/Makefile index aa093e79254..f0361516341 100644 --- a/sysutils/ups-nut/Makefile +++ b/sysutils/ups-nut/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2001/11/17 15:50:56 lukem Exp $ +# $NetBSD: Makefile,v 1.12 2001/11/19 04:25:15 lukem Exp $ # DISTNAME= nut-0.45.2 @@ -15,20 +15,14 @@ COMMENT= Network UPS Tools .if exists(/usr/sbin/user) ADDUSER= /usr/sbin/useradd ADDGROUP= /usr/sbin/groupadd -USERDEL= /usr/sbin/userdel -GROUPDEL= /usr/sbin/groupdel .else DEPENDS+= user>=20000313:../../sysutils/user ADDUSER= ${LOCALBASE}/sbin/useradd ADDGROUP= ${LOCALBASE}/sbin/groupadd -USERDEL= ${LOCALBASE}/sbin/userdel -GROUPDEL= ${LOCALBASE}/sbin/groupdel .endif .elif ${OPSYS} == "SunOS" ADDUSER= useradd ADDGROUP= groupadd -USERDEL= userdel -GROUPDEL= groupdel .endif DEINSTALL_FILE= ${WRKDIR}/DEINSTALL INSTALL_FILE= ${WRKDIR}/INSTALL @@ -43,26 +37,26 @@ CONFIGURE_ARGS+= --sysconfdir=${LOCALBASE}/etc/nut \ --with-group=${NUT_GROUP} \ --with-statepath=/var/db/nut +FILES_SUBST= NUT_USER=${NUT_USER} +FILES_SUBST+= NUT_GROUP=${NUT_GROUP} + +FILES_SUBST+= ADDGROUP=${ADDGROUP:Q} +FILES_SUBST+= ADDUSER=${ADDUSER:Q} +FILES_SUBST+= CAT=${CAT:Q} +FILES_SUBST+= CHGRP=${CHGRP:Q} +FILES_SUBST+= ID=${ID:Q} +FILES_SUBST+= RM=${RM:Q} +FILES_SUBST+= TOUCH=${TOUCH:Q} + +FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} + pre-configure: cd ${WRKSRC} && autoreconf --force pre-install: - ${SED} -e 's|@NUT_USER@|${NUT_USER}|g' \ - -e 's|@NUT_GROUP@|${NUT_GROUP}|g' \ - -e 's|@USERDEL@|${USERDEL}|g' \ - -e 's|@GROUPDEL@|${GROUPDEL}|g' \ - < ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} - ${SED} -e 's|@NUT_USER@|${NUT_USER}|g' \ - -e 's|@NUT_GROUP@|${NUT_GROUP}|g' \ - -e 's|@USERDIR@|${USERDIR}|g' \ - -e 's|@ADDUSER@|${ADDUSER}|g' \ - -e 's|@ADDGROUP@|${ADDGROUP}|g' \ - -e 's|@CHGRP@|${CHGRP}|g' \ - -e 's|@ID@|${ID}|g' \ - -e 's|@RM@|${RM}|g' \ - -e 's|@TOUCH@|${TOUCH}|g' \ - < ${PKGDIR}/INSTALL > ${INSTALL_FILE} - ${SH} ${INSTALL_FILE} + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/INSTALL > ${INSTALL_FILE} + PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL post-install: @${SED} -e "/%%PREFIX%%/s##${LOCALBASE}#g" \ @@ -77,5 +71,6 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/docs/FAQ ${NUT_DOCDIR} ${INSTALL_DATA} ${WRKSRC}/docs/Changes.trust ${NUT_DOCDIR} ${INSTALL_DATA} ${WRKSRC}/README ${NUT_DOCDIR} + PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL .include "../../mk/bsd.pkg.mk" |