summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall/backend/functions-disk.sh
diff options
context:
space:
mode:
authorjpaetzel <jpaetzel@FreeBSD.org>2011-11-08 23:44:26 +0000
committerjpaetzel <jpaetzel@FreeBSD.org>2011-11-08 23:44:26 +0000
commit65c845ce4a1064c29fab10b13db0b578d81cbca4 (patch)
tree4ae87cae5af18e87c23d6c2a38ee216372f829dc /usr.sbin/pc-sysinstall/backend/functions-disk.sh
parent32c0708d27ab0b9410bcd267cca168d14cfa2841 (diff)
downloadFreeBSD-src-65c845ce4a1064c29fab10b13db0b578d81cbca4.zip
FreeBSD-src-65c845ce4a1064c29fab10b13db0b578d81cbca4.tar.gz
Welcome the initial patches for OSX bootcamp support!!!
This should let you select the ada0p3 hybrid MBR/GPT partition, and do an installation to it. Approved by: kib (mentor) Obtained from: kris@pcbsd.org MFC after: 3 days
Diffstat (limited to 'usr.sbin/pc-sysinstall/backend/functions-disk.sh')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
index c3f1b22..51a659e 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
@@ -496,6 +496,13 @@ setup_disk_slice()
run_gpart_slice "${DISK}" "${BMANAGER}" "${s}"
;;
+ p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20)
+ tmpSLICE="${DISK}${PTYPE}"
+ # Get the number of the gpt partition we are working on
+ s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`"
+ run_gpart_gpt_part "${DISK}" "${BMANAGER}" "${s}"
+ ;;
+
free)
tmpSLICE="${DISK}s${LASTSLICE}"
run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}"
@@ -704,6 +711,58 @@ run_gpart_full()
fi
};
+# Function which runs gpart on a specified gpt partition
+run_gpart_gpt_part()
+{
+ DISK=$1
+
+ # Set the slice we will use later
+ slice="${1}p${3}"
+
+ # Set our sysctl so we can overwrite any geom using drives
+ sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
+
+ # Get the number of the slice we are working on
+ slicenum="$3"
+
+ # Stop any journaling
+ stop_gjournal "${slice}"
+
+ # Make sure we have disabled swap on this drive
+ if [ -e "${slice}b" ]
+ then
+ swapoff ${slice}b >/dev/null 2>/dev/null
+ swapoff ${slice}b.eli >/dev/null 2>/dev/null
+ fi
+
+ # Modify partition type
+ echo_log "Running gpart modify on ${DISK}"
+ rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}"
+ sleep 2
+
+ # Clean up old partition
+ echo_log "Cleaning up $slice"
+ rc_halt "dd if=/dev/zero of=${DISK}p${slicenum} count=1024"
+
+ sleep 4
+
+ # Init the MBR partition
+ rc_halt "gpart create -s BSD ${DISK}p${slicenum}"
+
+ # Set the slice to the format we'll be using for gpart later
+ slice=`echo "${1}:${3}:gptslice" | sed 's|/|-|g'`
+
+ # Lets save our slice, so we know what to look for in the config file later on
+ if [ -z "$WORKINGSLICES" ]
+ then
+ WORKINGSLICES="${slice}"
+ export WORKINGSLICES
+ else
+ WORKINGSLICES="${WORKINGSLICES} ${slice}"
+ export WORKINGSLICES
+ fi
+};
+
# Function which runs gpart on a specified s1-4 slice
run_gpart_slice()
{
OpenPOWER on IntegriCloud