Date: Sat, 28 Jan 2012 11:32:39 GMT From: Chris Rees <crees@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/164568: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users Message-ID: <201201281132.q0SBWdO5091656@freefall.freebsd.org> Resent-Message-ID: <201201281140.q0SBe7xp095386@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 164568 >Category: ports >Synopsis: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users >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: Sat Jan 28 11:40:06 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Chris Rees >Release: FreeBSD 8.2-STABLE i386 >Organization: >Environment: System: FreeBSD freefall.freebsd.org 8.2-STABLE FreeBSD 8.2-STABLE #5 r227907: Wed Nov 23 21:55:50 UTC 2011 simon@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386 >Description: bacula-server uses pkg-install scripts to create users on installation, and should use the USERS hooks in bsd.port.mk. It also should not set DEFAULT_PGSQL_VER. >How-To-Repeat: >Fix: --- patch.txt begins here --- Index: Makefile =================================================================== RCS file: /home/pcvs/ports/sysutils/bacula-server/Makefile,v retrieving revision 1.132 diff -u -r1.132 Makefile --- Makefile 15 Jan 2012 22:35:00 -0000 1.132 +++ Makefile 28 Jan 2012 11:30:15 -0000 @@ -17,6 +17,9 @@ UNIQUENAME?= ${PORTNAME}${PKGNAMESUFFIX} +USERS= bacula +GROUPS= ${USERS} + PLIST_SUB+= MAJOR=${PORTVERSION:R:R} USE_GMAKE= yes @@ -161,7 +164,6 @@ LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3 DBTYPE= sqlite3 .else -DEFAULT_PGSQL_VER?= 83 USE_PGSQL= yes CONFIGURE_ARGS+= --with-postgresql=yes DBTYPE= postgresql Index: files/pkg-install.client.in =================================================================== RCS file: /home/pcvs/ports/sysutils/bacula-server/files/pkg-install.client.in,v retrieving revision 1.3 diff -u -r1.3 pkg-install.client.in --- files/pkg-install.client.in 7 Sep 2010 16:21:42 -0000 1.3 +++ files/pkg-install.client.in 28 Jan 2012 11:30:15 -0000 @@ -2,14 +2,6 @@ PATH=/bin:/usr/bin:/usr/sbin -# Install UID/GID -USER=%%BACULA_USER%% -GROUP=%%BACULA_GROUP%% -UID=%%BACULA_UID%% -GID=%%BACULA_UID%% -BACULA_DIR=%%BACULA_DIR%% - - # Always add lines in /etc/services grep -q "bacula-dir" /etc/services if [ "$?" != "0" ]; then @@ -19,24 +11,3 @@ bacula-sd 9103/tcp #Bacula storage daemon # Bacule port end" >> /etc/services fi - -case $2 in -PRE-INSTALL) - if [ ! -d ${BACULA_DIR} ]; then - mkdir -p ${BACULA_DIR} - fi - - if pw group show "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if pw groupadd ${GROUP} -g ${GID}; then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - exit 1 - fi - fi - - chgrp -R ${GROUP} ${BACULA_DIR} - ;; -esac Index: files/pkg-install.server.in =================================================================== RCS file: /home/pcvs/ports/sysutils/bacula-server/files/pkg-install.server.in,v retrieving revision 1.2 diff -u -r1.2 pkg-install.server.in --- files/pkg-install.server.in 7 Sep 2010 16:21:42 -0000 1.2 +++ files/pkg-install.server.in 28 Jan 2012 11:30:15 -0000 @@ -2,13 +2,6 @@ PATH=/bin:/usr/bin:/usr/sbin -# Install UID/GID -USER=%%BACULA_USER%% -GROUP=%%BACULA_GROUP%% -UID=%%BACULA_UID%% -GID=%%BACULA_UID%% -BACULA_DIR=%%BACULA_DIR%% - # Always add lines in /etc/services grep -q "bacula-dir" /etc/services if [ "$?" != "0" ]; then @@ -18,43 +11,3 @@ bacula-sd 9103/tcp #Bacula storage daemon # Bacule port end" >> /etc/services fi - -case $2 in -PRE-INSTALL) - if [ ! -d ${BACULA_DIR} ]; then - mkdir -p ${BACULA_DIR} - fi - - if pw group show "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if pw groupadd ${GROUP} -g ${GID}; then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - exit 1 - fi - fi - - if pw user show "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." - if pw usermod ${USER} -d ${BACULA_DIR} -G operator - then - echo "Changed home directory of \"${USER}\" to \"${BACULA_DIR}\"" - else - echo "Changing home directory of \"${USER}\" to \"${BACULA_DIR}\" failed..." - exit 1 - fi - else - if pw useradd ${USER} -u ${UID} -g ${GROUP} -G operator -h - \ - -d ${BACULA_DIR} -s /sbin/nologin -c "Bacula Daemon" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi - chown -R ${USER}:${GROUP} ${BACULA_DIR} - ;; -esac --- patch.txt ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201281132.q0SBWdO5091656>