Deleted Added
full compact
functions-bsdlabel.sh (214188) functions-bsdlabel.sh (217229)
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 214188 2010-10-21 22:46:10Z imp $
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh 217229 2011-01-10 19:11:25Z 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

--- 118 unchanged lines hidden (view full) ---

153 fi
154 done
155
156
157 VAL="${NAME}${NUM}"
158 export VAL
159};
160
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

--- 118 unchanged lines hidden (view full) ---

153 fi
154 done
155
156
157 VAL="${NAME}${NUM}"
158 export VAL
159};
160
161# Function to setup / stamp a legacy MBR bsdlabel
162setup_mbr_partitions()
161# Function to setup partitions using gpart
162setup_gpart_partitions()
163{
163{
164 DISKTAG="$1"
165 WRKSLICE="$2"
164 local _dTag="$1"
165 local _pDisk="$2"
166 local _wSlice="$3"
167 local _sNum="$4"
168 local _pType="$5"
166 FOUNDPARTS="1"
167
169 FOUNDPARTS="1"
170
168 # Lets setup the BSDLABEL
169 BSDLABEL="${TMPDIR}/bsdLabel-${WRKSLICE}"
170 export BSDLABEL
171 rm $BSDLABEL >/dev/null 2>/dev/null
172 echo "# /dev/${WRKSLICE}" >>$BSDLABEL
173 echo "8 partitions:" >>$BSDLABEL
174 echo "# size offset fstype bsize bps/cpg" >>$BSDLABEL
175
176 PARTLETTER="a"
171 # Lets read in the config file now and setup our partitions
172 if [ "${_pType}" = "gpt" ] ; then
173 CURPART="2"
174 else
175 PARTLETTER="a"
176 CURPART="1"
177 rc_halt "gpart create -s BSD ${_wSlice}"
178 fi
177
179
178 # Lets read in the config file now and populate this
179 while read line
180 do
181 # Check for data on this slice
180 while read line
181 do
182 # Check for data on this slice
182 echo $line | grep "^${DISKTAG}-part=" >/dev/null 2>/dev/null
183 echo $line | grep "^${_dTag}-part=" >/dev/null 2>/dev/null
183 if [ "$?" = "0" ]
184 then
184 if [ "$?" = "0" ]
185 then
185 # Found a slice- entry, lets get the slice info
186 get_value_from_string "${line}"
187 STRING="$VAL"
188 FOUNDPARTS="0"
186 FOUNDPARTS="0"
189
190 # We need to split up the string now, and pick out the variables
191 FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1`
192 SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
193 MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3`
194
195 if echo $STRING | grep -E '^/.+' >/dev/null 2>&1
196 then
197 IMAGE=`echo ${STRING} | cut -f1 -d' '`
198 fi
199
200 # Check if we have a .eli extension on this FS
201 echo ${FS} | grep ".eli" >/dev/null 2>/dev/null
202 if [ "$?" = "0" ]
203 then
204 FS="`echo ${FS} | cut -d '.' -f 1`"
205 ENC="ON"
206 check_for_enc_pass "${line}"
207 if [ "${VAL}" != "" ] ; then
208 # We have a user supplied password, save it for later
209 ENCPASS="${VAL}"
210 fi
211 else
212 ENC="OFF"
213 fi
214
215 # Check if the user tried to setup / as an encrypted partition
216 check_for_mount "${MNT}" "/"
217 if [ "${?}" = "0" -a "${ENC}" = "ON" ]
218 then
219 USINGENCROOT="0" ; export USINGENCROOT
220 fi
221
222 if [ -n "${IMAGE}" ]
223 then
224 FS="IMAGE"
225 SIZE=`ls -l "${IMAGE}" | awk '{ print $5 }'`
226 MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
227 SIZE=`convert_byte_to_megabyte $SIZE`
228 fi
229
230 # Now check that these values are sane
231 case $FS in
232 UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP|IMAGE) ;;
233 *) exit_err "ERROR: Invalid file system specified on $line" ;;
234 esac
235
236 # Check that we have a valid size number
237 expr $SIZE + 1 >/dev/null 2>/dev/null
238 if [ "$?" != "0" ]; then
239 exit_err "ERROR: The size specified on $line is invalid"
240 fi
241
242 # Check that the mount-point starts with /
243 echo "$MNT" | grep -e "^/" -e "^none" >/dev/null 2>/dev/null
244 if [ "$?" != "0" ]; then
245 exit_err "ERROR: The mount-point specified on $line is invalid"
246 fi
247
248 if [ "$SIZE" = "0" ]
249 then
250 SOUT="*"
251 else
252 SOUT="${SIZE}M"
253 fi
254
255 # OK, we passed all tests, now lets put these values into a config
256 # If the part
257 if [ "${PARTLETTER}" = "a" ]
258 then
259 if [ "$FS" = "SWAP" ]
260 then
261 echo "a: ${SOUT} * swap 0 0" >>${BSDLABEL}
262 else
263 echo "a: ${SOUT} 0 4.2BSD 0 0" >>${BSDLABEL}
264 fi
265
266 # Check if we found a valid root partition
267 check_for_mount "${MNT}" "/"
268 if [ "$?" = "0" ] ; then
269 FOUNDROOT="0" ; export FOUNDROOT
270 fi
271
272 # Check if we have a "/boot" instead
273 check_for_mount "${MNT}" "/boot"
274 if [ "${?}" = "0" ] ; then
275 USINGBOOTPART="0" ; export USINGBOOTPART
276 if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ]
277 then
278 exit_err "/boot partition must be formatted with UFS"
279 fi
280 fi
281
282 else
283 # Done with the a: partitions
284
285 # Check if we found a valid root partition not on a:
286 check_for_mount "${MNT}" "/"
287 if [ "${?}" = "0" ] ; then
288 FOUNDROOT="1" ; export FOUNDROOT
289 fi
290
291 # Check if we have a /boot partition, and fail since its not first
292 check_for_mount "${MNT}" "/boot"
293 if [ "${?}" = "0" ] ; then
294 exit_err "/boot partition must be first partition"
295 fi
296
297
298 if [ "$FS" = "SWAP" ]
299 then
300 echo "${PARTLETTER}: ${SOUT} * swap" >>${BSDLABEL}
301 else
302 echo "${PARTLETTER}: ${SOUT} * 4.2BSD" >>${BSDLABEL}
303 fi
304 fi
305
306 # Generate a unique label name for this mount
307 gen_glabel_name "${MNT}" "${FS}"
308 PLABEL="${VAL}"
309
310 # Get any extra options for this fs / line
311 get_fs_line_xvars "${WRKSLICE}${PARTLETTER}" "${STRING}"
312 XTRAOPTS="${VAR}"
313
314 # Check if using zfs mirror
315 echo ${XTRAOPTS} | grep "mirror" >/dev/null 2>/dev/null
316 if [ "$?" = "0" ] ; then
317 XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${WRKSLICE}${PARTLETTER}")
318 fi
319
320 # Save this data to our partition config dir
321 echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
322
323 # If we have a enc password, save it as well
324 if [ ! -z "${ENCPASS}" ] ; then
325 echo "${ENCPASS}" >${PARTDIR}-enc/${WRKSLICE}${PARTLETTER}-encpass
326 fi
327
328 # This partition letter is used, get the next one
329 case ${PARTLETTER} in
330 a) PARTLETTER="b" ;;
331 b) # When we hit b, add the special c: setup for bsdlabel
332 echo "c: * * unused" >>${BSDLABEL}
333 PARTLETTER="d" ;;
334 d) PARTLETTER="e" ;;
335 e) PARTLETTER="f" ;;
336 f) PARTLETTER="g" ;;
337 g) PARTLETTER="h" ;;
338 h) PARTLETTER="ERR" ;;
339 *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;;
340 esac
341
342 unset IMAGE
343
344 fi # End of subsection locating a slice in config
345
346 echo $line | grep "^commitDiskLabel" >/dev/null 2>/dev/null
347 if [ "$?" = "0" -a "${FOUNDPARTS}" = "0" ]
348 then
349 # Found our flag to commit this label setup, check that we found at least 1 partition and do it
350 if [ "${PARTLETTER}" != "a" ]
351 then
352 # Check if we only had 1 partition, and make sure we add "c:" section to label
353 if [ "${PARTLETTER}" = "b" ]
354 then
355 echo "c: * * unused" >>${BSDLABEL}
356 fi
357
358 echo "bsdlabel -R -B /dev/${WRKSLICE} ${BSDLABEL}"
359 bsdlabel -R -B ${WRKSLICE} ${BSDLABEL}
360
361 break
362 else
363 exit_err "ERROR: commitDiskLabel was called without any partition entries for it!"
364 fi
365 fi
366 done <${CFGF}
367};
368
369# Function to setup partitions using gpt
370setup_gpt_partitions()
371{
372 DISKTAG="$1"
373 DISK="$2"
374 FOUNDPARTS="1"
375
376 # Lets read in the config file now and setup our GPT partitions
377 CURPART="2"
378 while read line
379 do
380 # Check for data on this slice
381 echo $line | grep "^${DISKTAG}-part=" >/dev/null 2>/dev/null
382 if [ "$?" = "0" ]
383 then
384 FOUNDPARTS="0"
385 # Found a slice- entry, lets get the slice info
386 get_value_from_string "${line}"
387 STRING="$VAL"
388
389 # We need to split up the string now, and pick out the variables
390 FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1`
391 SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
392 MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3`

--- 43 unchanged lines hidden (view full) ---

436 SOUT=""
437 else
438 SOUT="-s ${SIZE}M"
439 fi
440
441 # Check if we found a valid root partition
442 check_for_mount "${MNT}" "/"
443 if [ "${?}" = "0" ] ; then
187 # Found a slice- entry, lets get the slice info
188 get_value_from_string "${line}"
189 STRING="$VAL"
190
191 # We need to split up the string now, and pick out the variables
192 FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1`
193 SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
194 MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3`

--- 43 unchanged lines hidden (view full) ---

238 SOUT=""
239 else
240 SOUT="-s ${SIZE}M"
241 fi
242
243 # Check if we found a valid root partition
244 check_for_mount "${MNT}" "/"
245 if [ "${?}" = "0" ] ; then
444 if [ "${CURPART}" = "2" ] ; then
246 FOUNDROOT="1" ; export FOUNDROOT
247 if [ "${CURPART}" = "2" -a "$_pType" = "gpt" ] ; then
445 FOUNDROOT="0" ; export FOUNDROOT
248 FOUNDROOT="0" ; export FOUNDROOT
446 else
447 FOUNDROOT="1" ; export FOUNDROOT
448 fi
249 fi
250 if [ "${CURPART}" = "1" -a "$_pType" = "mbr" ] ; then
251 FOUNDROOT="0" ; export FOUNDROOT
252 fi
449 fi
450
451 check_for_mount "${MNT}" "/boot"
452 if [ "${?}" = "0" ] ; then
253 fi
254
255 check_for_mount "${MNT}" "/boot"
256 if [ "${?}" = "0" ] ; then
453 if [ "${CURPART}" = "2" ] ; then
454 USINGBOOTPART="0" ; export USINGBOOTPART
455 if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ]
456 then
457 exit_err "/boot partition must be formatted with UFS"
458 fi
459 else
257 USINGBOOTPART="0" ; export USINGBOOTPART
258 if [ "${CURPART}" != "2" -a "${_pType}" = "gpt" ] ; then
460 exit_err "/boot partition must be first partition"
461 fi
259 exit_err "/boot partition must be first partition"
260 fi
261 if [ "${CURPART}" != "1" -a "${_pType}" = "mbr" ] ; then
262 exit_err "/boot partition must be first partition"
263 fi
264
265 if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ] ; then
266 exit_err "/boot partition must be formatted with UFS"
267 fi
462 fi
463
464 # Generate a unique label name for this mount
465 gen_glabel_name "${MNT}" "${FS}"
466 PLABEL="${VAL}"
467
468 # Get any extra options for this fs / line
268 fi
269
270 # Generate a unique label name for this mount
271 gen_glabel_name "${MNT}" "${FS}"
272 PLABEL="${VAL}"
273
274 # Get any extra options for this fs / line
469 get_fs_line_xvars "${DISK}p${CURPART}" "${STRING}"
275 if [ "${_pType}" = "gpt" ] ; then
276 get_fs_line_xvars "${_pDisk}p${CURPART}" "${STRING}"
277 else
278 get_fs_line_xvars "${_wSlice}" "${STRING}"
279 fi
470 XTRAOPTS="${VAR}"
471
472 # Check if using zfs mirror
473 echo ${XTRAOPTS} | grep "mirror" >/dev/null 2>/dev/null
474 if [ "$?" = "0" ] ; then
280 XTRAOPTS="${VAR}"
281
282 # Check if using zfs mirror
283 echo ${XTRAOPTS} | grep "mirror" >/dev/null 2>/dev/null
284 if [ "$?" = "0" ] ; then
475 XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${DISK}p${CURPART}")
285 if [ "${_pType}" = "gpt" ] ; then
286 XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}")
287 else
288 XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_wSlice}")
289 fi
476 fi
477
478 # Figure out the gpart type to use
479 case ${FS} in
480 ZFS) PARTYPE="freebsd-zfs" ;;
481 SWAP) PARTYPE="freebsd-swap" ;;
482 *) PARTYPE="freebsd-ufs" ;;
483 esac
484
485 # Create the partition
290 fi
291
292 # Figure out the gpart type to use
293 case ${FS} in
294 ZFS) PARTYPE="freebsd-zfs" ;;
295 SWAP) PARTYPE="freebsd-swap" ;;
296 *) PARTYPE="freebsd-ufs" ;;
297 esac
298
299 # Create the partition
486 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${DISK}"
300 if [ "${_pType}" = "gpt" ] ; then
301 if [ "$CURPART" = "2" ] ; then
302 # If this is GPT, make sure first partition is aligned to 4k
303 rc_halt "gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}"
304 else
305 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}"
306 fi
307 else
308 rc_halt "gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}"
309 fi
487
488 # Check if this is a root / boot partition, and stamp the right loader
489 for TESTMNT in `echo ${MNT} | sed 's|,| |g'`
490 do
491 if [ "${TESTMNT}" = "/" -a -z "${BOOTTYPE}" ] ; then
492 BOOTTYPE="${PARTYPE}"
493 fi
494 if [ "${TESTMNT}" = "/boot" ] ; then
495 BOOTTYPE="${PARTYPE}"
496 fi
497 done
498
499 # Save this data to our partition config dir
310
311 # Check if this is a root / boot partition, and stamp the right loader
312 for TESTMNT in `echo ${MNT} | sed 's|,| |g'`
313 do
314 if [ "${TESTMNT}" = "/" -a -z "${BOOTTYPE}" ] ; then
315 BOOTTYPE="${PARTYPE}"
316 fi
317 if [ "${TESTMNT}" = "/boot" ] ; then
318 BOOTTYPE="${PARTYPE}"
319 fi
320 done
321
322 # Save this data to our partition config dir
500 echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS}" >${PARTDIR}/${DISK}p${CURPART}
323 if [ "${_pType}" = "gpt" ] ; then
324 echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS}" >${PARTDIR}/${_pDisk}p${CURPART}
501
325
502 # Clear out any headers
503 sleep 2
504 dd if=/dev/zero of=${DISK}p${CURPART} count=2048 >/dev/null 2>/dev/null
326 # Clear out any headers
327 sleep 2
328 dd if=/dev/zero of=${_pDisk}p${CURPART} count=2048 >/dev/null 2>/dev/null
505
329
506 # If we have a enc password, save it as well
507 if [ ! -z "${ENCPASS}" ] ; then
508 echo "${ENCPASS}" >${PARTDIR}-enc/${DISK}p${CURPART}-encpass
330 # If we have a enc password, save it as well
331 if [ ! -z "${ENCPASS}" ] ; then
332 echo "${ENCPASS}" >${PARTDIR}-enc/${_pDisk}p${CURPART}-encpass
333 fi
334 else
335 # MBR Partition
336 echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${_wSlice}${PARTLETTER}
337 # Clear out any headers
338 sleep 2
339 dd if=/dev/zero of=${_wSlice}${PARTLETTER} count=2048 >/dev/null 2>/dev/null
340
341 # If we have a enc password, save it as well
342 if [ ! -z "${ENCPASS}" ] ; then
343 echo "${ENCPASS}" >${PARTDIR}-enc/${_wSlice}${PARTLETTER}-encpass
344 fi
509 fi
510
345 fi
346
347
511 # Increment our parts counter
348 # Increment our parts counter
512 CURPART="`expr ${CURPART} + 1`"
349 if [ "$_pType" = "gpt" ] ; then
350 CURPART="`expr ${CURPART} + 1`"
351 # If this is a gpt partition, we can continue and skip the MBR part letter stuff
352 continue
353 else
354 CURPART="`expr ${CURPART} + 1`"
355 if [ "$CURPART" = "3" ] ; then CURPART="4" ; fi
356 fi
513
357
358
359 # This partition letter is used, get the next one
360 case ${PARTLETTER} in
361 a) PARTLETTER="b" ;;
362 b) PARTLETTER="d" ;;
363 d) PARTLETTER="e" ;;
364 e) PARTLETTER="f" ;;
365 f) PARTLETTER="g" ;;
366 g) PARTLETTER="h" ;;
367 h) PARTLETTER="ERR" ;;
368 *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;;
369 esac
370
514 fi # End of subsection locating a slice in config
515
516 echo $line | grep "^commitDiskLabel" >/dev/null 2>/dev/null
517 if [ "$?" = "0" -a "${FOUNDPARTS}" = "0" ]
518 then
519
520 # If this is the boot disk, stamp the right gptboot
371 fi # End of subsection locating a slice in config
372
373 echo $line | grep "^commitDiskLabel" >/dev/null 2>/dev/null
374 if [ "$?" = "0" -a "${FOUNDPARTS}" = "0" ]
375 then
376
377 # If this is the boot disk, stamp the right gptboot
521 if [ ! -z "${BOOTTYPE}" ] ; then
378 if [ ! -z "${BOOTTYPE}" -a "$_pType" = "gpt" ] ; then
522 case ${BOOTTYPE} in
379 case ${BOOTTYPE} in
523 freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;;
524 freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;;
380 freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${_pDisk}" ;;
381 freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_pDisk}" ;;
525 esac
526 fi
527
382 esac
383 fi
384
385 # Make sure to stamp the MBR loader
386 if [ "$_pType" = "mbr" ] ; then
387 rc_halt "gpart bootcode -b /boot/boot ${_wSlice}"
388 fi
528
529 # Found our flag to commit this label setup, check that we found at least 1 partition
530 if [ "${CURPART}" = "2" ] ; then
531 exit_err "ERROR: commitDiskLabel was called without any partition entries for it!"
532 fi
533
534 break
535 fi

--- 23 unchanged lines hidden (view full) ---

559
560 if [ -e "${SLICECFGDIR}/${wrkslice}" ]
561 then
562 disktag="`cat ${SLICECFGDIR}/${wrkslice}`"
563 else
564 exit_err "ERROR: Missing SLICETAG data. This shouldn't happen - please let the developers know"
565 fi
566
389
390 # Found our flag to commit this label setup, check that we found at least 1 partition
391 if [ "${CURPART}" = "2" ] ; then
392 exit_err "ERROR: commitDiskLabel was called without any partition entries for it!"
393 fi
394
395 break
396 fi

--- 23 unchanged lines hidden (view full) ---

420
421 if [ -e "${SLICECFGDIR}/${wrkslice}" ]
422 then
423 disktag="`cat ${SLICECFGDIR}/${wrkslice}`"
424 else
425 exit_err "ERROR: Missing SLICETAG data. This shouldn't happen - please let the developers know"
426 fi
427
567 # Using Traditional MBR for dual-booting
568 if [ "$type" = "mbr" ] ; then
569 setup_mbr_partitions "${disktag}" "${wrkslice}"
570 fi
571
428
572 # Using entire disk mode, use GPT for this
573 if [ "$type" = "gpt" ] ; then
574 setup_gpt_partitions "${disktag}" "${disk}"
575 fi
429 # Setup the partitions with gpart
430 setup_gpart_partitions "${disktag}" "${disk}" "${wrkslice}" "${slicenum}" "${type}"
576
577};
578
579# Function which reads in the disk slice config, and performs it
580setup_disk_label()
581{
582 # We are ready to start setting up the label, lets read the config and do the actions
583 # First confirm that we have a valid WORKINGSLICES

--- 236 unchanged lines hidden ---
431
432};
433
434# Function which reads in the disk slice config, and performs it
435setup_disk_label()
436{
437 # We are ready to start setting up the label, lets read the config and do the actions
438 # First confirm that we have a valid WORKINGSLICES

--- 236 unchanged lines hidden ---