Commit 1de1eff5 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Cleanup disklabel.py

Remove --print-last-linux and change some other argument names
parent 83d0c566
......@@ -551,7 +551,7 @@ mount_all() {
if [[ "$osfamily" =~ ^(open|net)bsd$ ]]; then
# OpenBSD DUIDs device naming
if [[ "${entry[1]}" =~ ^[a-f0-9]{16}\.[a-p]$ ]]; then
duid="$(@scriptsdir@/disklabel.py --print-duid "$device")"
duid="$(@scriptsdir@/disklabel.py --get-duid "$device")"
if [[ ! "${entry[1]}" =~ ^$duid ]]; then
warn "fstab refers to unknown DUID: \`$duid'"
......
......@@ -515,13 +515,10 @@ if __name__ == '__main__':
parser.add_option("-l", "--list", action="store_true", dest="list",
default=False,
help="list the disklabel on the specified media")
parser.add_option("--print-last", action="store_true", dest="last_part",
default=False,
parser.add_option("--get-last-partition", action="store_true",
dest="last_part", default=False,
help="print the label of the last partition")
parser.add_option("--print-last-linux", action="store_true",
dest="last_linux", default=False,
help="print the linux number for the last partition")
parser.add_option("--print-duid", action="store_true", dest="duid",
parser.add_option("--get-duid", action="store_true", dest="duid",
default=False,
help="print the disklabel unique identifier")
parser.add_option("-d", "--enlarge-disk", type="int", dest="disk_size",
......@@ -550,12 +547,6 @@ if __name__ == '__main__':
if options.last_part:
print "%c" % chr(ord('a') + disklabel.get_last_partition_id())
if options.last_linux:
part_id = disklabel.get_last_partition_id()
# The linux kernel does not assign a partition for label 'c' that
# describes the whole disk
print part_id + (4 if part_id > 2 else 5)
if options.disk_size is not None:
disklabel.enlarge_disk(options.disk_size)
......
......@@ -37,13 +37,19 @@ if [ ! -b "$SNF_IMAGE_DEV" ]; then
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
part="${SNF_IMAGE_DEV}$(@scriptsdir@/disklabel.py --print-last-linux "$SNF_IMAGE_DEV")"
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")"
# If this fails the script will stop
$DUMPFS_OPENBSD "$part" > /dev/null
$DUMPFS_OPENBSD "$part" > /dev/null ||
{ warn "Filesystem is not UFS. Resizing ommited"; exit 0; }
$GROWFS_OPENBSD -y "$part"
exit 0
$GROWFS_OPENBSD -y "$part"
exit 0
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = netbsd ]; then
......
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