functions-mountdisk.sh (220909) | functions-mountdisk.sh (232899) |
---|---|
1#!/bin/sh 2#- 3# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# | 1#!/bin/sh 2#- 3# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# |
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh 220909 2011-04-21 06:25:12Z jpaetzel $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh 232899 2012-03-12 21:32:43Z jpaetzel $ |
27 28# Functions related mounting the newly formatted disk partitions 29 30# Mounts all the specified partition to the mount-point 31mount_partition() 32{ 33 if [ -z "${1}" -o -z "${2}" -o -z "${3}" ] 34 then --- 17 unchanged lines hidden (view full) --- 52 #We are on ZFS, lets setup this mount-point 53 if [ "${PARTFS}" = "ZFS" ] 54 then 55 ZPOOLNAME=$(get_zpool_name "${PART}") 56 57 # Check if we have multiple zfs mounts specified 58 for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'` 59 do | 27 28# Functions related mounting the newly formatted disk partitions 29 30# Mounts all the specified partition to the mount-point 31mount_partition() 32{ 33 if [ -z "${1}" -o -z "${2}" -o -z "${3}" ] 34 then --- 17 unchanged lines hidden (view full) --- 52 #We are on ZFS, lets setup this mount-point 53 if [ "${PARTFS}" = "ZFS" ] 54 then 55 ZPOOLNAME=$(get_zpool_name "${PART}") 56 57 # Check if we have multiple zfs mounts specified 58 for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'` 59 do |
60 # Check for any ZFS specific mount options 61 ZMNTOPTS="`echo $ZMNT | cut -d '(' -f 2 | cut -d ')' -f 1`" 62 if [ "$ZMNTOPTS" = "$ZMNT" ] ; then ZMNTOPTS="" ; fi 63 64 # Reset ZMNT with options removed 65 ZMNT="`echo $ZMNT | cut -d '(' -f 1`" 66 |
|
60 # First make sure we create the mount point 61 if [ ! -d "${FSMNT}${ZMNT}" ] ; then 62 mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT} 63 fi 64 | 67 # First make sure we create the mount point 68 if [ ! -d "${FSMNT}${ZMNT}" ] ; then 69 mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT} 70 fi 71 |
72 # Check for any volsize args 73 zcopt="" 74 for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` 75 do 76 echo "$ZOPT" | grep -q volsize 77 if [ $? -eq 0 ] ; then 78 volsize=`echo $ZOPT | cut -d '=' -f 2` 79 zcopt="-V $volsize" 80 fi 81 done 82 |
|
65 if [ "${ZMNT}" = "/" ] ; then 66 ZNAME="" 67 else 68 ZNAME="${ZMNT}" | 83 if [ "${ZMNT}" = "/" ] ; then 84 ZNAME="" 85 else 86 ZNAME="${ZMNT}" |
69 echo_log "zfs create -p ${ZPOOLNAME}${ZNAME}" 70 rc_halt "zfs create -p ${ZPOOLNAME}${ZNAME}" | 87 echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" 88 rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" |
71 fi 72 sleep 2 | 89 fi 90 sleep 2 |
73 rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}" | 91 if [ -z "$zcopt" ] ; then 92 rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}" 93 fi |
74 | 94 |
75 # Disable atime for this zfs partition, speed increase 76 rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}" 77 done | 95 # If no ZFS options, we can skip 96 if [ -z "$ZMNTOPTS" ] ; then continue ; fi |
78 | 97 |
98 # Parse any ZFS options now 99 for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` 100 do 101 echo "$ZOPT" | grep -q volsize 102 if [ $? -eq 0 ] ; then continue ; fi 103 rc_halt "zfs set $ZOPT ${ZPOOLNAME}${ZNAME}" 104 done 105 done # End of adding ZFS mounts 106 |
|
79 else 80 # If we are not on ZFS, lets do the mount now 81 # First make sure we create the mount point 82 if [ ! -d "${FSMNT}${MNTPOINT}" ] 83 then 84 mkdir -p ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT} 85 fi 86 --- 15 unchanged lines hidden (view full) --- 102 for PART in `ls ${PARTDIR}` 103 do 104 PARTDEV=`echo $PART | sed 's|-|/|g'` 105 if [ ! -e "${PARTDEV}" ] 106 then 107 exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" 108 fi 109 | 107 else 108 # If we are not on ZFS, lets do the mount now 109 # First make sure we create the mount point 110 if [ ! -d "${FSMNT}${MNTPOINT}" ] 111 then 112 mkdir -p ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT} 113 fi 114 --- 15 unchanged lines hidden (view full) --- 130 for PART in `ls ${PARTDIR}` 131 do 132 PARTDEV=`echo $PART | sed 's|-|/|g'` 133 if [ ! -e "${PARTDEV}" ] 134 then 135 exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" 136 fi 137 |
110 PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" 111 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" 112 PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" | 138 PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" 139 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" 140 PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" |
113 114 if [ "${PARTENC}" = "ON" ] 115 then 116 EXT=".eli" 117 else 118 EXT="" 119 fi 120 --- 18 unchanged lines hidden (view full) --- 139 for PART in `ls ${PARTDIR}` 140 do 141 PARTDEV=`echo $PART | sed 's|-|/|g'` 142 if [ ! -e "${PARTDEV}" ] 143 then 144 exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" 145 fi 146 | 141 142 if [ "${PARTENC}" = "ON" ] 143 then 144 EXT=".eli" 145 else 146 EXT="" 147 fi 148 --- 18 unchanged lines hidden (view full) --- 167 for PART in `ls ${PARTDIR}` 168 do 169 PARTDEV=`echo $PART | sed 's|-|/|g'` 170 if [ ! -e "${PARTDEV}" ] 171 then 172 exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" 173 fi 174 |
147 PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" 148 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" 149 PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" | 175 PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" 176 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" 177 PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" |
150 151 if [ "${PARTENC}" = "ON" ] 152 then 153 EXT=".eli" 154 else 155 EXT="" 156 fi 157 --- 36 unchanged lines hidden --- | 178 179 if [ "${PARTENC}" = "ON" ] 180 then 181 EXT=".eli" 182 else 183 EXT="" 184 fi 185 --- 36 unchanged lines hidden --- |