Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2012 07:45:06 +0000 (UTC)
From:      Mark Linimon <linimon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r244766 - projects/portbuild/tools
Message-ID:  <201212280745.qBS7j6Nd080169@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: linimon (doc,ports committer)
Date: Fri Dec 28 07:45:06 2012
New Revision: 244766
URL: http://svnweb.freebsd.org/changeset/base/244766

Log:
  Here is how you have to do this:
  
   - (before this script) as root, create the zpool.  let zfs mount it
     for you.
   - umount it.
   - delegate the zfs permissions to user 'portbuild'.
   - *as user portbuild*, remount the zpool.
  
  Now you are free to proceed.

Modified:
  projects/portbuild/tools/mkportbuild

Modified: projects/portbuild/tools/mkportbuild
==============================================================================
--- projects/portbuild/tools/mkportbuild	Fri Dec 28 06:52:53 2012	(r244765)
+++ projects/portbuild/tools/mkportbuild	Fri Dec 28 07:45:06 2012	(r244766)
@@ -51,12 +51,12 @@ if [ -z "${name}" ]; then
   echo "ZFS volume ${ZFS_VOLUME} does not exist.  You must create it first."
   exit 1
 fi
+
 mountpoint=`zfs list -H -t filesystem -o mountpoint ${ZFS_VOLUME}`
-if [ -z "${mountpoint}" ]; then
-  echo "ZFS volume ${ZFS_VOLUME} is not mounted.  I'll mount it for you."
-  zfs mount ${ZFS_VOLUME} || exit 1
+if [ ! -z "${mountpoint}" ]; then
+  echo "ZFS volume ${ZFS_VOLUME} is mounted.  I'll unmount it for you then remount it later."
+  zfs umount ${ZFS_VOLUME} || exit 1
 fi
-chown ${PORTBUILD_USER}:${PORTBUILD_USER} ${ZFS_MOUNTPOINT} || exit 1
 
 # reset the "zfsadmin" permission set if it already exists. 
 zfs unallow -s @zfsadmin ${ZFS_VOLUME} 2> /dev/null   
@@ -73,6 +73,13 @@ echo "results of ZFS operations:"
 zfs list ${ZFS_VOLUME}
 zfs allow ${ZFS_VOLUME}
 
+chown ${PORTBUILD_USER}:${PORTBUILD_USER} ${ZFS_MOUNTPOINT} || exit 1
+mountpoint=`zfs list -H -t filesystem -o mountpoint ${ZFS_VOLUME}`
+if [ -z "${mountpoint}" ]; then
+  echo "ZFS volume ${ZFS_VOLUME} is not mounted.  I'll remount it for you."
+  su -m ${PORTBUILD_USER} -c "zfs mount ${ZFS_VOLUME}" || exit 1
+fi
+
 # create a place to hold the repository
 if [ ! -d ${ZFS_MOUNTPOINT}/portbuild ]; then
   su -m ${PORTBUILD_USER} -c "zfs create ${ZFS_VOLUME}/portbuild" || exit 1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212280745.qBS7j6Nd080169>