? ports/Mk/users-groups-bpm-v3.diff ? ports/audio/pulseaudio/pulseaudio-0.9.10_1.tbz Index: ports/Mk/bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.592 diff -u -r1.592 bsd.port.mk --- ports/Mk/bsd.port.mk 14 Apr 2008 16:46:41 -0000 1.592 +++ ports/Mk/bsd.port.mk 19 May 2008 15:13:00 -0000 @@ -580,6 +580,10 @@ # Default: ${MASTERDIR}/files # PKGDIR - A directory containing any package creation files. # Default: ${MASTERDIR} +# UID_FILES - A list of files containing information about registered UIDs. +# Note that files have decreasing priority. +# GID_FILES - A list of files containing information about registered GIDs. +# Note that files have decreasing priority. # # Variables that serve as convenient "aliases" for your *-install targets. # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin". @@ -997,6 +1001,11 @@ # Default: ${PREFIX}/www/${PORTNAME} # WWWDIR_REL - The WWWDIR relative to ${PREFIX} # +# USERS - List of users to create at install time. Each login must have a +# corresponding entry in ${UID_FILES}. +# GROUPS - List of groups to create at install time. Each group must have a +# corresponding entry in ${GID_FILES}. +# # DESKTOPDIR - Name of the directory to install ${DESKTOP_ENTRIES} in. # Default: ${PREFIX}/share/applications # DESKTOP_ENTRIES @@ -1226,6 +1235,11 @@ # where 'make config' records user configuration options PORT_DBDIR?= /var/db/ports +UID_FILES?= ${PORTSDIR}/UIDs +GID_FILES?= ${PORTSDIR}/GIDs +UID_OFFSET?= 0 +GID_OFFSET?= 0 + LDCONFIG_DIR= libdata/ldconfig LDCONFIG32_DIR= libdata/ldconfig32 @@ -3901,6 +3915,81 @@ .endif .endif +.if !target(create-users-groups) +create-users-groups: +.if defined(GROUPS) || defined(USERS) +.if defined(GROUPS) +.for _file in ${GID_FILES} +.if !exists(${_file}) + @${ECHO_CMD} "** ${_file} doesn't exist. Exiting."; exit 1 +.endif +.endfor + @${ECHO_MSG} "===> Creating users and/or groups." +.for _group in ${GROUPS} +# _bgpd:*:130: + @if ! ${GREP} -h ^${_group}: ${GID_FILES} >/dev/null 2>&1; then \ + ${ECHO_CMD} "** Cannot find any information about group \`${_group}' in ${GID_FILES}."; \ + exit 1; \ + fi + @IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \ + gid=$$(($$gid+${GID_OFFSET}));\ + if ! ${PW} groupshow $$group >/dev/null 2>&1; then \ + ${ECHO_MSG} "Creating group \`$$group' with gid \`$$gid'."; \ + ${PW} groupadd $$group -g $$gid; \ + else \ + ${ECHO_MSG} "Using existing group \`$$group'."; \ + fi; \ + ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then ${PW} groupadd $$group -g $$gid; fi" >> ${TMPPLIST}; \ + done +.endfor +.endif +.if defined(USERS) +.for _file in ${UID_FILES} +.if !exists(${_file}) + @${ECHO_CMD} "** ${_file} doesn't exist. Exiting."; exit 1 +.endif +.endfor +.for _user in ${USERS} +# _bgpd:*:130:130:BGP Daemon:/var/empty:/sbin/nologin + @if ! ${GREP} -h ^${_user}: ${UID_FILES} >/dev/null 2>&1; then \ + ${ECHO_CMD} "** Cannot find any information about user \`${_user}' in ${UID_FILES}."; \ + exit 1; \ + fi + @IFS=":"; ${GREP} -h ^${_user}: ${UID_FILES} | head -n 1 | while read login passwd uid gid gecos homedir shell; do \ + uid=$$(($$uid+${UID_OFFSET}));\ + gid=$$(($$gid+${GID_OFFSET}));\ + if ! ${PW} usershow $$login >/dev/null 2>&1; then \ + ${ECHO_MSG} "Creating user \`$$login' with uid \`$$uid'."; \ + ${PW} useradd $$login -u $$uid -g $$gid -c "$$gecos" -d $$homedir -s $$shell; \ + else \ + ${ECHO_MSG} "Using existing user \`$$login'."; \ + fi; \ + ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then ${PW} useradd $$login -u $$uid -g $$gid -c \"$$gecos\" -d $$homedir -s $$shell; fi" >> ${TMPPLIST}; \ + done + @${ECHO_CMD} "@unexec if ${PW} usershow ${_user} >/dev/null 2>&1; then ${PW} userdel ${_user}; fi" >> ${TMPPLIST} +.endfor +.if defined(GROUPS) +.for _group in ${GROUPS} +# _bgpd:*:130: + @IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \ + gid=$$(($$gid+${GID_OFFSET}));\ + IFS=","; for _login in $$members; do \ + list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \ + ${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \ + ${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \ + ${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; ${PW} usermod $${_login} -G \$${list},${_group}" >> ${TMPPLIST}; \ + ${ECHO_CMD} "@unexec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p' | ${SED} -e 's/${_group}//'\`; ${PW} usermod $${_login} -G \$${list}" >> ${TMPPLIST}; \ + done; \ + done + @${ECHO_CMD} "@unexec if ${PW} groupshow ${_group} >/dev/null 2>&1; then ${PW} groupdel ${_group}; fi" >> ${TMPPLIST} +.endfor +.endif +.endif +.else + @${DO_NADA} +.endif +.endif + .if !defined(DISABLE_SECURITY_CHECK) .if !target(security-check) .if !defined(OLD_SECURITY_CHECK) @@ -4085,8 +4174,8 @@ pre-install-script generate-plist check-already-installed _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install install-desktop-entries \ - post-install post-install-script add-plist-info \ - add-plist-docs add-plist-examples add-plist-data \ + create-users-groups post-install post-install-script \ + add-plist-info add-plist-docs add-plist-examples add-plist-data \ add-plist-post install-rc-script compress-man \ install-ldconfig-file fake-pkg security-check _PACKAGE_DEP= install Index: ports/audio/pulseaudio/Makefile =================================================================== RCS file: /home/ncvs/ports/audio/pulseaudio/Makefile,v retrieving revision 1.27 diff -u -r1.27 Makefile --- ports/audio/pulseaudio/Makefile 19 Apr 2008 17:46:32 -0000 1.27 +++ ports/audio/pulseaudio/Makefile 19 May 2008 15:13:00 -0000 @@ -8,7 +8,7 @@ PORTNAME= pulseaudio PORTVERSION= 0.9.10 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MASTER_SITES= http://0pointer.de/lennart/projects/${PORTNAME}/ @@ -33,6 +33,9 @@ CONFIGURE_ARGS= --localstatedir=/var \ --disable-lirc # untested +USERS= pulse +GROUPS= pulse pulse-access pulse-rt + OPTIONS= JACK "JACK audio support" Off \ AVAHI "Enable Avahi mDNS support" On \ HAL "Enable HAL support" On \ @@ -94,9 +97,6 @@ ${INSTALL_DATA} ${WRKSRC}/src/${ii} \ ${PREFIX}/etc/pulse/${ii}-dist .endfor -.if !defined(PACKAGE_BUILDING) - @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL -.endif @${CAT} ${PKGMESSAGE} .include Index: ports/audio/pulseaudio/pkg-install =================================================================== RCS file: ports/audio/pulseaudio/pkg-install diff -N ports/audio/pulseaudio/pkg-install --- ports/audio/pulseaudio/pkg-install 2 Apr 2008 14:20:47 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,63 +0,0 @@ -#!/bin/sh - -case $2 in -POST-INSTALL) - RGROUP=pulse-rt - SUSER=pulse - SGROUP=${SUSER} - AGROUP=pulse-access - SUID=563 - RGID=557 - SGID=${SUID} - AGID=564 - PW=/usr/sbin/pw - - if ${PW} group show "${RGROUP}" 2>/dev/null; then - echo "You already have a group \"${RGROUP}\", so I will use it." - else - if ${PW} groupadd ${RGROUP} -g ${RGID}; then - echo "Added group \"${RGROUP}\"." - else - echo "Adding group \"${RGROUP}\" failed..." - exit 1 - fi - fi - - if ${PW} group show "${SGROUP}" 2>/dev/null; then - echo "You already have a group \"${SGROUP}\", so I will use it." - else - if ${PW} groupadd ${SGROUP} -g ${SGID}; then - echo "Added group \"${SGROUP}\"." - else - echo "Adding group \"${SGROUP}\" failed..." - exit 1 - fi - fi - - if ${PW} group show "${AGROUP}" 2>/dev/null; then - echo "You already have a group \"${AGROUP}\", so I will use it." - else - if ${PW} groupadd ${AGROUP} -g ${AGID}; then - echo "Added group \"${AGROUP}\"." - else - echo "Adding group \"${AGROUP}\" failed..." - exit 1 - fi - fi - - if ${PW} user show "${SUSER}" 2>/dev/null; then - echo "You already have a user \"${SUSER}\", so I will use it." - else - if ${PW} useradd ${SUSER} -u ${SUID} -g ${SGROUP} -h - \ - -d "/nonexistent" -s /sbin/nologin -c "PulseAudio System User" - then - echo "Added user \"${SUSER}\"." - else - echo "Adding user \"${SUSER}\" failed..." - exit 1 - fi - fi - echo "" - exit 0 - ;; -esac Index: ports/devel/dbus/Makefile =================================================================== RCS file: /home/ncvs/ports/devel/dbus/Makefile,v retrieving revision 1.71 diff -u -r1.71 Makefile --- ports/devel/dbus/Makefile 21 Apr 2008 06:25:05 -0000 1.71 +++ ports/devel/dbus/Makefile 19 May 2008 15:13:00 -0000 @@ -35,6 +35,9 @@ USE_RC_SUBR= dbus USE_GNOME_SUBR= yes +USERS= messagebus +GROUPS= messagebus + PLIST_SUB= VERSION="1.0" MAN1= dbus-cleanup-sockets.1 dbus-daemon.1 dbus-launch.1 \ Index: ports/devel/dbus/pkg-install =================================================================== RCS file: /home/ncvs/ports/devel/dbus/pkg-install,v retrieving revision 1.5 diff -u -r1.5 pkg-install --- ports/devel/dbus/pkg-install 24 Mar 2008 03:49:35 -0000 1.5 +++ ports/devel/dbus/pkg-install 19 May 2008 15:13:00 -0000 @@ -4,33 +4,6 @@ POST-INSTALL) USER=messagebus GROUP=${USER} - UID=556 - GID=${UID} - PW=/usr/sbin/pw - - 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." - else - if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "/nonexistent" -s /sbin/nologin -c "D-BUS Daemon User" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi /usr/bin/install -d -o ${USER} -g ${GROUP} /var/run/dbus /usr/bin/install -d -o ${USER} -g ${GROUP} /var/db/dbus Index: ports/sysutils/hal/Makefile =================================================================== RCS file: /home/ncvs/ports/sysutils/hal/Makefile,v retrieving revision 1.38 diff -u -r1.38 Makefile --- ports/sysutils/hal/Makefile 19 May 2008 06:24:44 -0000 1.38 +++ ports/sysutils/hal/Makefile 19 May 2008 15:13:00 -0000 @@ -8,6 +8,7 @@ PORTNAME= hal DISTVERSION= 0.5.11 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= http://hal.freedesktop.org/releases/ @@ -48,6 +49,9 @@ #HALVERSION= 0.5.10 #SNAPVERSION= 20080218 + +USERS= haldaemon +GROUPS= haldaemon USE_RC_SUBR= hald USE_GNOME_SUBR= yes Index: ports/sysutils/hal/files/pkg-install.in =================================================================== RCS file: /home/ncvs/ports/sysutils/hal/files/pkg-install.in,v retrieving revision 1.3 diff -u -r1.3 pkg-install.in --- ports/sysutils/hal/files/pkg-install.in 21 Apr 2008 06:38:07 -0000 1.3 +++ ports/sysutils/hal/files/pkg-install.in 19 May 2008 15:13:00 -0000 @@ -4,33 +4,6 @@ POST-INSTALL) USER=haldaemon GROUP=${USER} - UID=560 - GID=${UID} - PW=/usr/sbin/pw - - 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." - else - if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "/nonexistent" -s /sbin/nologin -c "HAL Daemon User" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi /usr/bin/install -d -o ${USER} -g ${GROUP} /var/run/hald /usr/bin/install -d -o ${USER} -g ${GROUP} /var/cache/hald Index: ports/sysutils/policykit/Makefile =================================================================== RCS file: /home/ncvs/ports/sysutils/policykit/Makefile,v retrieving revision 1.11 diff -u -r1.11 Makefile --- ports/sysutils/policykit/Makefile 1 May 2008 01:01:48 -0000 1.11 +++ ports/sysutils/policykit/Makefile 19 May 2008 15:13:00 -0000 @@ -8,7 +8,7 @@ PORTNAME= policykit PORTVERSION= 0.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils gnome MASTER_SITES= http://hal.freedesktop.org/releases/ DISTNAME= PolicyKit-${PORTVERSION} @@ -21,6 +21,9 @@ ${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:${PORTSDIR}/textproc/docbook-xsl LIB_DEPENDS= dbus-glib-1.2:${PORTSDIR}/devel/dbus-glib \ expat.6:${PORTSDIR}/textproc/expat2 + +USERS= polkit +GROUPS= polkit USE_GNOME= gnomehack gnometarget glib20 intlhack USE_GMAKE= yes Index: ports/sysutils/policykit/pkg-install =================================================================== RCS file: /home/ncvs/ports/sysutils/policykit/pkg-install,v retrieving revision 1.3 diff -u -r1.3 pkg-install --- ports/sysutils/policykit/pkg-install 24 Mar 2008 03:50:18 -0000 1.3 +++ ports/sysutils/policykit/pkg-install 19 May 2008 15:13:00 -0000 @@ -4,33 +4,6 @@ POST-INSTALL) USER=polkit GROUP=${USER} - UID=562 - GID=${UID} - PW=/usr/sbin/pw - - 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." - else - if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "/nonexistent" -s /sbin/nologin -c "PolicyKit Daemon User" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi /usr/bin/install -d -o root -m 0770 -g ${GROUP} /var/run/PolicyKit /usr/bin/install -d -o root -m 0770 -g ${GROUP} /var/lib/PolicyKit Index: ports/x11/gdm/Makefile =================================================================== RCS file: /home/ncvs/ports/x11/gdm/Makefile,v retrieving revision 1.100 diff -u -r1.100 Makefile --- ports/x11/gdm/Makefile 14 May 2008 18:16:22 -0000 1.100 +++ ports/x11/gdm/Makefile 19 May 2008 15:13:01 -0000 @@ -8,6 +8,7 @@ PORTNAME= gdm PORTVERSION= 2.20.6 +PORTREVISION= 1 CATEGORIES= x11 gnome MASTER_SITES= GNOME DIST_SUBDIR= gnome2 @@ -20,6 +21,9 @@ ck-connector.0:${PORTSDIR}/sysutils/consolekit RUN_DEPENDS= zenity:${PORTSDIR}/x11/zenity \ xrdb:${PORTSDIR}/x11/xrdb + +USERS= gdm +GROUPS= gdm USE_BZIP2= yes USE_GETTEXT= yes Index: ports/x11/gdm/pkg-install =================================================================== RCS file: /home/ncvs/ports/x11/gdm/pkg-install,v retrieving revision 1.13 diff -u -r1.13 pkg-install --- ports/x11/gdm/pkg-install 24 Oct 2007 23:36:53 -0000 1.13 +++ ports/x11/gdm/pkg-install 19 May 2008 15:13:01 -0000 @@ -4,36 +4,10 @@ POST-INSTALL) USER=gdm GROUP=${USER} - UID=92 - GID=${UID} - PW=/usr/sbin/pw CHMOD=/bin/chmod CHOWN=/usr/sbin/chown MKDIR=/bin/mkdir - 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." - else - if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "/nonexistent" -s /sbin/nologin -c "GNOME Display Manager" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi ${MKDIR} -p /var/gdm ${MKDIR} -p /var/log/gdm ${CHOWN} -R root:${GROUP} /var/gdm