Date: Sun, 24 Jan 2010 15:55:23 GMT From: Sevan Janiyan <venture37@geeklan.co.uk> To: FreeBSD-gnats-submit@FreeBSD.org Cc: lth@FreeBSD.org Subject: ports/143172: [PATCH] net-mgmt/ifgraph: use $SUB_FILES & $SUB_LIST to dynamically update pkg-install deinstall & message files Message-ID: <201001241555.o0OFtNRs022885@newbie.thingamajig-systems.co.uk> Resent-Message-ID: <201001241600.o0OG07Gm092784@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 143172 >Category: ports >Synopsis: [PATCH] net-mgmt/ifgraph: use $SUB_FILES & $SUB_LIST to dynamically update pkg-install deinstall & message files >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jan 24 16:00:07 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Sevan Janiyan >Release: FreeBSD 8.0-RELEASE-p2 amd64 >Organization: >Environment: System: FreeBSD newbie.thingamajig-systems.co.uk 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan 5 21:11:58 UTC >Description: no need to invoke sed manually Added file(s): - files/pkg-deinstall.in - files/pkg-install.in - files/pkg-message.in Removed file(s): - pkg-deinstall - pkg-install - pkg-message Port maintainer (lth@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99 >How-To-Repeat: >Fix: --- ifgraph-0.4.10_2.patch begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/net-mgmt/ifgraph/Makefile,v retrieving revision 1.10 diff -u -r1.10 Makefile --- Makefile 22 Aug 2009 00:31:58 -0000 1.10 +++ Makefile 24 Jan 2010 15:52:50 -0000 @@ -32,26 +32,19 @@ PLFILES= find-if.pl ifgraph.pl makegraph.pl DOCFILES= CHANGELOG INSTALACAO INSTALL TODO LICENSE.TXT MUDANCAS -FILES_SUB= USER=${IFGRAPH_USER} GROUP=${IFGRAPH_GROUP} \ - PREFIX=${PREFIX} DOCSDIR=${DOCSDIR} \ - PERL=${PERL} LOCALBASE=${LOCALBASE} +SUB_FILES= crontab pkg-deinstall pkg-install pkg-message +SUB_LIST= USER=${IFGRAPH_USER} GROUP=${IFGRAPH_GROUP} PERL=${PERL} pre-install: - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${PKGDIR}/pkg-install > ${PKGINSTALL} @ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL do-install: - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${PKGDIR}/pkg-deinstall > ${PKGDEINSTALL} - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${PKGDIR}/pkg-message > ${PKGMESSAGE} .for plfile in ${PLFILES} - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @ ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/${plfile} > ${WRKDIR}/${plfile} @ ${INSTALL_SCRIPT} ${WRKDIR}/${plfile} ${PREFIX}/bin .endfor - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + @ ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/ifgraph.conf > ${WRKSRC}/ifgraph.conf.sample @ ${INSTALL_DATA} ${WRKSRC}/ifgraph.conf.sample ${PREFIX}/etc @ ${MKDIR} ${PREFIX}/ifgraph @@ -59,8 +52,7 @@ @ ${MKDIR} ${PREFIX}/ifgraph/lib @ ${CP} ${WRKSRC}/lib/rgb.txt ${PREFIX}/ifgraph/lib @ ${CP} -Rp ${WRKSRC}/templates ${PREFIX}/ifgraph - @ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${FILESDIR}/crontab.in > ${PREFIX}/ifgraph/crontab.in + @ ${INSTALL_DATA} ${WRKDIR}/crontab ${PREFIX}/ifgraph/crontab @ ${CHOWN} -R ifgraph:ifgraph ${PREFIX}/ifgraph @ ${MKDIR} ${PREFIX}/var/ifgraph @ ${CHOWN} ifgraph:ifgraph ${PREFIX}/var/ifgraph Index: pkg-deinstall =================================================================== RCS file: pkg-deinstall diff -N pkg-deinstall --- pkg-deinstall 8 Dec 2003 20:51:56 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ -#!/bin/sh -# -# $FreeBSD: ports/net-mgmt/ifgraph/pkg-deinstall,v 1.1 2003/12/08 20:51:56 krion Exp $ -# - -PATH=/bin:/usr/bin:/usr/sbin - -case $2 in - -DEINSTALL) - echo '---> Starting deinstall script:' - - echo '---> Zeroing crontab(5) file belonging to user "%%USER%%"' - /usr/bin/crontab -u %%USER%% /dev/null - echo ' (The crontab(5) will be deleted completely when user "%%USER%%" is removed.)' - - ;; - -POST-DEINSTALL) - echo '---> Starting post-deinstall script:' - - if [ -f %%PREFIX%%/etc/ifgraph.conf -o \ - -d %%PREFIX%%/ifgraph -o \ - -d %%PREFIX%%/var/ifgraph ]; then - echo '---> You seem to have made some custom ifGraph configuration.' - echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.' - echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".' - - else - echo '---> Removing group "%%GROUP%%"' - /usr/sbin/pw groupdel -n %%GROUP%% - echo '---> Removing user "%%USER%%"' - echo 'y' | /usr/sbin/pw userdel -n %%USER%% - fi - - ;; - -esac Index: pkg-install =================================================================== RCS file: pkg-install diff -N pkg-install --- pkg-install 8 Dec 2003 20:51:56 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,51 +0,0 @@ -#!/bin/sh -# -# $FreeBSD: ports/net-mgmt/ifgraph/pkg-install,v 1.1 2003/12/08 20:51:56 krion Exp $ -# - -PATH=/bin:/usr/bin:/usr/sbin - -case $2 in - -PRE-INSTALL) - echo "---> Starting pre-install script:" - - if [ -z "%%USER%%" -o \ - -z "%%GROUP%%" ]; then - echo "ERROR: A required pragma was empty" - exit 1 - fi - - if pw showgroup "%%GROUP%%" 2>/dev/null; then - echo "---> Using existing group \"%%GROUP%%\"" - else - echo "---> Adding group \"%%GROUP%%\"" - pw addgroup %%GROUP%% -h - || exit 1 - fi - - # Create user if required - if pw showuser "%%USER%%" 2>/dev/null; then - echo "---> Using existing user \"%%USER%%\"" - else - echo "---> Adding user \"%%USER%%\"" - pw adduser %%USER%% -g %%GROUP%% -h - \ - -s "/sbin/nologin" -c "ifGraph User" || exit 1 - fi - - ;; - -POST-INSTALL) - echo "---> Starting post-install script:" - - if [ -z "%%USER%%" -o \ - -z "%%PREFIX%%" ]; then - echo "ERROR: A required pragma was empty" - exit 1 - fi - - echo "---> Creating crontab(5) file for user \"%%USER%%\"" - crontab -u "%%USER%%" "%%PREFIX%%/ifgraph/crontab.in" || exit 1 - - ;; - -esac Index: pkg-message =================================================================== RCS file: pkg-message diff -N pkg-message --- pkg-message 8 Dec 2003 20:51:56 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,32 +0,0 @@ -================================================================= - -ifGraph has now been installed in %%PREFIX%%/ifgraph/. - -NOTE: A sample configuration files has been placed at: - - %%PREFIX%%/etc/ifgraph.conf.sample - -You need to copy this to - - %%PREFIX%%/etc/ifgraph.conf - -and edit it to suit your requirements. - -A sample crontab(5) entry has been installed. You need to activate -this to start measurements and graph generation. You can do this -with - - crontab -u ifgraph -e - -Documentation is installed in - - %%DOCSDIR%%/ - -To enable Apache web access, add the following to your -%%PREFIX%%/etc/apache/httpd.conf: - - Alias /ifgraph/ %%PREFIX%%/ifgraph/htdocs/ - -Enjoy! - -================================================================= Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/net-mgmt/ifgraph/pkg-plist,v retrieving revision 1.5 diff -u -r1.5 pkg-plist --- pkg-plist 31 Oct 2006 15:18:15 -0000 1.5 +++ pkg-plist 24 Jan 2010 15:52:50 -0000 @@ -5,7 +5,7 @@ bin/ifgraph.pl bin/makegraph.pl etc/ifgraph.conf.sample -ifgraph/crontab.in +ifgraph/crontab ifgraph/lib/rgb.txt ifgraph/templates/en/if-data.html ifgraph/templates/en/if-header.html Index: files/pkg-deinstall.in =================================================================== RCS file: files/pkg-deinstall.in diff -N files/pkg-deinstall.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/pkg-deinstall.in 24 Jan 2010 15:52:50 -0000 @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $FreeBSD: ports/net-mgmt/ifgraph/pkg-deinstall,v 1.1 2003/12/08 20:51:56 krion Exp $ +# + +PATH=/bin:/usr/bin:/usr/sbin + +case $2 in + +DEINSTALL) + echo '---> Starting deinstall script:' + + echo '---> Zeroing crontab(5) file belonging to user "%%USER%%"' + /usr/bin/crontab -u %%USER%% /dev/null + echo ' (The crontab(5) will be deleted completely when user "%%USER%%" is removed.)' + + ;; + +POST-DEINSTALL) + echo '---> Starting post-deinstall script:' + + if [ -f %%PREFIX%%/etc/ifgraph.conf -o \ + -d %%PREFIX%%/ifgraph -o \ + -d %%PREFIX%%/var/ifgraph ]; then + echo '---> You seem to have made some custom ifGraph configuration.' + echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.' + echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".' + + else + echo '---> Removing group "%%GROUP%%"' + /usr/sbin/pw groupdel -n %%GROUP%% + echo '---> Removing user "%%USER%%"' + echo 'y' | /usr/sbin/pw userdel -n %%USER%% + fi + + ;; + +esac Index: files/pkg-install.in =================================================================== RCS file: files/pkg-install.in diff -N files/pkg-install.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/pkg-install.in 24 Jan 2010 15:52:50 -0000 @@ -0,0 +1,51 @@ +#!/bin/sh +# +# $FreeBSD: ports/net-mgmt/ifgraph/pkg-install,v 1.1 2003/12/08 20:51:56 krion Exp $ +# + +PATH=/bin:/usr/bin:/usr/sbin + +case $2 in + +PRE-INSTALL) + echo "---> Starting pre-install script:" + + if [ -z "%%USER%%" -o \ + -z "%%GROUP%%" ]; then + echo "ERROR: A required pragma was empty" + exit 1 + fi + + if pw showgroup "%%GROUP%%" 2>/dev/null; then + echo "---> Using existing group \"%%GROUP%%\"" + else + echo "---> Adding group \"%%GROUP%%\"" + pw addgroup %%GROUP%% -h - || exit 1 + fi + + # Create user if required + if pw showuser "%%USER%%" 2>/dev/null; then + echo "---> Using existing user \"%%USER%%\"" + else + echo "---> Adding user \"%%USER%%\"" + pw adduser %%USER%% -g %%GROUP%% -h - \ + -s "/sbin/nologin" -c "ifGraph User" || exit 1 + fi + + ;; + +POST-INSTALL) + echo "---> Starting post-install script:" + + if [ -z "%%USER%%" -o \ + -z "%%PREFIX%%" ]; then + echo "ERROR: A required pragma was empty" + exit 1 + fi + + echo "---> Creating crontab(5) file for user \"%%USER%%\"" + crontab -u "%%USER%%" "%%PREFIX%%/ifgraph/crontab" || exit 1 + + ;; + +esac Index: files/pkg-message.in =================================================================== RCS file: files/pkg-message.in diff -N files/pkg-message.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/pkg-message.in 24 Jan 2010 15:52:50 -0000 @@ -0,0 +1,32 @@ +================================================================= + +ifGraph has now been installed in %%PREFIX%%/ifgraph/. + +NOTE: A sample configuration files has been placed at: + + %%PREFIX%%/etc/ifgraph.conf.sample + +You need to copy this to + + %%PREFIX%%/etc/ifgraph.conf + +and edit it to suit your requirements. + +A sample crontab(5) entry has been installed. You need to activate +this to start measurements and graph generation. You can do this +with + + crontab -u ifgraph -e + +Documentation is installed in + + %%DOCSDIR%%/ + +To enable Apache web access, add the following to your +%%PREFIX%%/etc/apache/httpd.conf: + + Alias /ifgraph/ %%PREFIX%%/ifgraph/htdocs/ + +Enjoy! + +================================================================= --- ifgraph-0.4.10_2.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001241555.o0OFtNRs022885>