functions-bsdlabel.sh (235006) | functions-bsdlabel.sh (240165) |
---|---|
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-bsdlabel.sh 235006 2012-05-04 15:36:51Z jpaetzel $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh 240165 2012-09-06 14:59:53Z jpaetzel $ |
27 28# Functions related to disk operations using bsdlabel 29 30# Check if we are are provided a geli password on the nextline of the config 31check_for_enc_pass() 32{ 33 CURLINE="${1}" 34 --- 124 unchanged lines hidden (view full) --- 159 break 160 fi 161 done 162 163 164 export VAL="${NAME}${NUM}" 165}; 166 | 27 28# Functions related to disk operations using bsdlabel 29 30# Check if we are are provided a geli password on the nextline of the config 31check_for_enc_pass() 32{ 33 CURLINE="${1}" 34 --- 124 unchanged lines hidden (view full) --- 159 break 160 fi 161 done 162 163 164 export VAL="${NAME}${NUM}" 165}; 166 |
167# Function to determine the size we can safely use when 0 is specified 168get_autosize() 169{ 170 # Disk tag to look for 171 dTag="$1" 172 173 # Total MB Avail 174 get_disk_mediasize_mb "$2" 175 local _aSize=$VAL 176 177 while read line 178 do 179 # Check for data on this slice 180 echo $line | grep -q "^${_dTag}-part=" 2>/dev/null 181 if [ $? -ne 0 ] ; then continue ; fi 182 183 get_value_from_string "${line}" 184 STRING="$VAL" 185 186 # Get the size of this partition 187 SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` 188 if [ $SIZE -eq 0 ] ; then continue ; fi 189 _aSize=`expr $_aSize - $SIZE` 190 done <${CFGF} 191 192 # Pad the size a bit 193 _aSize=`expr $_aSize - 2` 194 195 VAL="$_aSize" 196 export VAL 197}; 198 |
|
167# Function to setup partitions using gpart 168setup_gpart_partitions() 169{ 170 local _dTag="$1" 171 local _pDisk="$2" 172 local _wSlice="$3" 173 local _sNum="$4" 174 local _pType="$5" 175 FOUNDPARTS="1" | 199# Function to setup partitions using gpart 200setup_gpart_partitions() 201{ 202 local _dTag="$1" 203 local _pDisk="$2" 204 local _wSlice="$3" 205 local _sNum="$4" 206 local _pType="$5" 207 FOUNDPARTS="1" |
208 USEDAUTOSIZE=0 |
|
176 177 # Lets read in the config file now and setup our partitions 178 if [ "${_pType}" = "gpt" ] ; then 179 CURPART="2" 180 elif [ "${_pType}" = "apm" ] ; then 181 CURPART="3" 182 else 183 PARTLETTER="a" --- 56 unchanged lines hidden (view full) --- 240 # Check that the mount-point starts with / 241 echo "$MNT" | grep -qe "^/" -e "^none" 2>/dev/null 242 if [ $? -ne 0 ]; then 243 exit_err "ERROR: The mount-point specified on $line is invalid" 244 fi 245 246 if [ "$SIZE" = "0" ] 247 then | 209 210 # Lets read in the config file now and setup our partitions 211 if [ "${_pType}" = "gpt" ] ; then 212 CURPART="2" 213 elif [ "${_pType}" = "apm" ] ; then 214 CURPART="3" 215 else 216 PARTLETTER="a" --- 56 unchanged lines hidden (view full) --- 273 # Check that the mount-point starts with / 274 echo "$MNT" | grep -qe "^/" -e "^none" 2>/dev/null 275 if [ $? -ne 0 ]; then 276 exit_err "ERROR: The mount-point specified on $line is invalid" 277 fi 278 279 if [ "$SIZE" = "0" ] 280 then |
248 SOUT="" | 281 if [ $USEDAUTOSIZE -eq 1 ] ; then 282 exit_err "ERROR: You can not have two partitions with a size of 0 specified!" 283 fi 284 case ${_pType} in 285 gpt|apm) get_autosize "${_dTag}" "$_pDisk" ;; 286 *) get_autosize "${_dTag}" "$_wSlice" ;; 287 esac 288 SOUT="-s ${VAL}M" 289 USEDAUTOSIZE=1 |
249 else 250 SOUT="-s ${SIZE}M" 251 fi 252 253 # Check if we found a valid root partition 254 check_for_mount "${MNT}" "/" 255 if [ $? -eq 0 ] ; then 256 export FOUNDROOT="1" --- 474 unchanged lines hidden --- | 290 else 291 SOUT="-s ${SIZE}M" 292 fi 293 294 # Check if we found a valid root partition 295 check_for_mount "${MNT}" "/" 296 if [ $? -eq 0 ] ; then 297 export FOUNDROOT="1" --- 474 unchanged lines hidden --- |