Commit 49967718 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Merge branch 'feature-enlarge-netbsd'

parents d9980653 a2a04353
......@@ -487,22 +487,19 @@ get_unattend() {
echo "$exists"
}
disklabel2linux() {
local partition i p
bsd2linux() {
local partition device
partition="$1"
device="$2"
i=4
# Partition 'c' traditionally used to describe the entire disk is not
# mapped to /dev/sda7 by the kernel
for p in a b {d..p}; do
let i++
if [ "$p" = "$partition" ]; then
echo "$i"
return 0
fi
done
linux_part=$(@scriptsdir@/disklabel.py --get-partitions-mapping "$device" | grep ^"$partition": | cut -d" " -f2)
if [[ "$linux_part" =~ ^[1-9][0-9]*$ ]]; then
echo "$linux_part"
return 0
fi
log_error "Invalid BSD partition label: \`$partition'"
log_error "Couldn't find out mapping for BSD partition: \`$partition' in \`$device'"
}
mount_all() {
......
This diff is collapsed.
......@@ -35,7 +35,7 @@ if [ ! -b "$SNF_IMAGE_DEV" ]; then
log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
if [[ "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ ^(open|net)bsd$ ]]; then
@scriptsdir@/disklabel.py -d "$($BLOCKDEV --getsz "$SNF_IMAGE_DEV")" -p "$SNF_IMAGE_DEV"
# Tell the kernel to recreate the disk partitions.
# We cannot use partprobe to do this because partprobe uses BLKPG ioctl
......@@ -47,11 +47,6 @@ if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
exit 0
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = netbsd ]; then
warn "Partition resizing currently not supported for NetBSD"
exit 0
fi
table=$(get_partition_table "$SNF_IMAGE_DEV")
if [ $(get_partition_count "$table") -eq 0 ]; then
......
......@@ -36,14 +36,14 @@ if [ ! -b "$SNF_IMAGE_DEV" ]; then
log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
if [[ "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ ^(open|net)bsd$ ]]; then
bsd_part="$(@scriptsdir@/disklabel.py --get-last-partition "$SNF_IMAGE_DEV")"
if [ "$bsd_part" = "b" ]; then
warn "Last partition is swap space. Resizing ommited"
exit 0
fi
part="${SNF_IMAGE_DEV}$(disklabel2linux "$bsd_part")"
part="${SNF_IMAGE_DEV}$(bsd2linux "$bsd_part" "$SNF_IMAGE_DEV")"
$DUMPFS_OPENBSD "$part" > /dev/null ||
{ warn "Filesystem is not UFS. Resizing ommited"; exit 0; }
......@@ -52,11 +52,6 @@ if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
exit 0
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = netbsd ]; then
warn "File system resizing currently not supported for NetBSD"
exit 0
fi
if [ -z "$SNF_IMAGE_RESIZE_PART" ]; then
warn "No partition chosen for resize"
exit 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment