Index: Uses/uidfix.mk =================================================================== --- Uses/uidfix.mk (revision 0) +++ Uses/uidfix.mk (working copy) @@ -0,0 +1,15 @@ +# $FreeBSD$ +# +# Changes some default behaviour of build systems to allow installing as user. +# +# MAINTAINER: bapt@FreeBSD.org +# +# Feature: uidfix +# Usage: USES=uidfix +# Valid ARGS: none +# +.if !defined(_INCLUDE_USES_UIDFIX_MK) +.if ${UID} != 0 +MAKE_ENV+= BINOWN=${UID} SHAREOWN=${UID} CONFOWN=${UID} +.endif +.endif Property changes on: Uses/uidfix.mk ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: bsd.port.mk =================================================================== --- bsd.port.mk (revision 328100) +++ bsd.port.mk (working copy) @@ -1489,6 +1489,10 @@ USES+= gmake .endif +.if !defined(UID) +UID!= ${ID} -u +.endif + # Loading features .for f in ${USES} _f=${f:C/\:.*//g} @@ -1620,10 +1624,6 @@ .endif .endif -.if !defined(UID) -UID!= ${ID} -u -.endif - # Check the compatibility layer for amd64/ia64 .if ${ARCH} == "amd64" || ${ARCH} =="ia64" @@ -4114,6 +4114,7 @@ fi @IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \ gid=$$(($$gid+${GID_OFFSET})); \ + if [ "${NEED_ROOT}" != "" ]; then \ if ! ${PW} groupshow $$group >/dev/null 2>&1; then \ ${ECHO_MSG} "Creating group \`$$group' with gid \`$$gid'."; \ ${PW} groupadd $$group -g $$gid; \ @@ -4120,6 +4121,7 @@ else \ ${ECHO_MSG} "Using existing group \`$$group'."; \ fi; \ + fi ; \ ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then \ echo \"Creating group '$$group' with gid '$$gid'.\"; \ ${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"; fi" >> ${TMPPLIST}; \ @@ -4143,6 +4145,7 @@ gid=$$(($$gid+${GID_OFFSET})); \ class="$${class:+-L }$$class"; \ homedir=$$(echo $$homedir | sed "s|^/usr/local|${PREFIX}|"); \ + if [ "${NEED_ROOT}" != "" ]; then \ if ! ${PW} usershow $$login >/dev/null 2>&1; then \ ${ECHO_MSG} "Creating user \`$$login' with uid \`$$uid'."; \ eval ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \ @@ -4150,6 +4153,7 @@ else \ ${ECHO_MSG} "Using existing user \`$$login'."; \ fi; \ + fi; \ ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then \ echo \"Creating user '$$login' with uid '$$uid'.\"; \ ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \ @@ -4294,10 +4298,17 @@ _STAGE_DEP= build _STAGE_SEQ= stage-message stage-dir run-depends lib-depends apply-slist pre-install generate-plist \ pre-su-install +.if defined(NEED_ROOT) _STAGE_SUSEQ= create-users-groups do-install post-install post-stage compress-man \ install-rc-script install-ldconfig-file install-license \ install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ add-plist-data add-plist-post fix-plist-sequence +.else +_STAGE_SEQ+= create-users-groups do-install post-install post-stage compress-man \ + install-rc-script install-ldconfig-file install-license \ + install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ + add-plist-data add-plist-post fix-plist-sequence +.endif .if defined(WITH_PKGNG) _INSTALL_DEP= stage _INSTALL_SEQ= install-message run-depends lib-depends @@ -5720,7 +5731,7 @@ @${ECHO_MSG} "===> Generating temporary packing list" @${MKDIR} `${DIRNAME} ${TMPPLIST}` @if [ ! -f ${DESCR} ]; then ${ECHO_MSG} "** Missing pkg-descr for ${PKGNAME}."; exit 1; fi - @>${TMPPLIST} + @${ECHO_CMD} -e "@owner root\n@group wheel" >${TMPPLIST} @for file in ${PLIST_FILES}; do \ ${ECHO_CMD} $${file} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} >> ${TMPPLIST}; \ done