From 5f057fd2622b72a3ed3e17f0b9888e745393bdac Mon Sep 17 00:00:00 2001 From: lth Date: Thu, 12 Aug 2010 13:20:34 +0000 Subject: Use the USERS/GROUPS mechanism PR: ports/148320 Submitted by: Bapt --- net-mgmt/ifgraph/Makefile | 9 +++------ net-mgmt/ifgraph/files/pkg-deinstall.in | 21 +-------------------- net-mgmt/ifgraph/files/pkg-install.in | 30 +----------------------------- 3 files changed, 5 insertions(+), 55 deletions(-) (limited to 'net-mgmt') diff --git a/net-mgmt/ifgraph/Makefile b/net-mgmt/ifgraph/Makefile index 4d0dc4e0a5be..399cfe16d8e7 100644 --- a/net-mgmt/ifgraph/Makefile +++ b/net-mgmt/ifgraph/Makefile @@ -26,17 +26,14 @@ PKGMESSAGE= ${WRKDIR}/pkg-message PKGINSTALL= ${WRKDIR}/pkg-install PKGDEINSTALL= ${WRKDIR}/pkg-deinstall -IFGRAPH_USER= ifgraph -IFGRAPH_GROUP= ifgraph +USERS= ifgraph +GROUPS= ifgraph PLFILES= find-if.pl ifgraph.pl makegraph.pl DOCFILES= CHANGELOG INSTALACAO INSTALL TODO LICENSE.TXT MUDANCAS SUB_FILES= crontab pkg-deinstall pkg-install pkg-message -SUB_LIST= USER=${IFGRAPH_USER} GROUP=${IFGRAPH_GROUP} PERL=${PERL} - -pre-install: - @ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL +SUB_LIST= USER=${USERS} PERL=${PERL} do-install: .for plfile in ${PLFILES} diff --git a/net-mgmt/ifgraph/files/pkg-deinstall.in b/net-mgmt/ifgraph/files/pkg-deinstall.in index 8c58d2e1603f..6868a7f93bef 100644 --- a/net-mgmt/ifgraph/files/pkg-deinstall.in +++ b/net-mgmt/ifgraph/files/pkg-deinstall.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net-mgmt/ifgraph/files/pkg-deinstall.in,v 1.1 2010-01-24 18:51:29 lth Exp $ +# $FreeBSD: /tmp/pcvs/ports/net-mgmt/ifgraph/files/pkg-deinstall.in,v 1.2 2010-08-12 13:20:34 lth Exp $ # PATH=/bin:/usr/bin:/usr/sbin @@ -16,23 +16,4 @@ DEINSTALL) ;; -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 diff --git a/net-mgmt/ifgraph/files/pkg-install.in b/net-mgmt/ifgraph/files/pkg-install.in index 9cd574dd232d..56a52171ba89 100644 --- a/net-mgmt/ifgraph/files/pkg-install.in +++ b/net-mgmt/ifgraph/files/pkg-install.in @@ -1,39 +1,11 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net-mgmt/ifgraph/files/pkg-install.in,v 1.1 2010-01-24 18:51:29 lth Exp $ +# $FreeBSD: /tmp/pcvs/ports/net-mgmt/ifgraph/files/pkg-install.in,v 1.2 2010-08-12 13:20:34 lth 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:" -- cgit