Changeset 3f8cc13


Ignore:
Timestamp:
07/23/13 10:13:08 (12 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
eec2eb4
Parents:
d64173f
Message:

When creating ZFS datasets, check for the parent dataset. If it does *not*
exist, then we will create a parent with the "canmount=off" flag first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pc-sysinstall/backend/functions-mountdisk.sh

    r1620346 r3f8cc13  
    9292        ZNAME="${ZMNT}" 
    9393        ZMKMNT="${ZMNT}" 
     94 
     95        # Lets check if we are missing any parent dataset 
     96        chkDir=`dirname $ZMNT` 
     97        mkParents="" 
     98        while 
     99        z=0 
     100        do 
     101                # Are we at the base dataset? 
     102                if [ "$chkDir" = "/" ]; then break ; fi 
     103 
     104                # Do we have this dataset? 
     105                zfs list | grep -q "^${ZPOOLNAME}${chkDir} " 
     106                if [ $? -eq 0 ]; then break ; fi 
     107 
     108                # Save this dataset to create 
     109                mkParents="$chkDir $mkParents" 
     110                 
     111                # Get the next dir to check 
     112                chkDir=`dirname $chkDir` 
     113        done 
     114 
     115        # Any ZFS parent datasets to create? 
     116        if [ -n "$mkParents" ] ; then 
     117                for p in $mkParents 
     118                do 
     119                        # Since the user didn't explictly specify this dataset 
     120                        # we assume they don't really want it mounted 
     121                        echo_log "zfs create -o canmount=off -p ${ZPOOLNAME}${p}" 
     122                        rc_halt "zfs create -o canmount=off -p ${ZPOOLNAME}${p}" 
     123                done 
     124        fi 
     125 
     126        # Create the target ZFS dataset now 
    94127        echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" 
    95128        rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" 
Note: See TracChangeset for help on using the changeset viewer.