Revision 1de1eff5

b/snf-image-helper/common.sh.in
551 551
            if [[ "$osfamily" =~ ^(open|net)bsd$ ]]; then
552 552
                # OpenBSD DUIDs device naming
553 553
                if [[ "${entry[1]}" =~ ^[a-f0-9]{16}\.[a-p]$ ]]; then
554
                    duid="$(@scriptsdir@/disklabel.py --print-duid "$device")"
554
                    duid="$(@scriptsdir@/disklabel.py --get-duid "$device")"
555 555

  
556 556
                    if [[ ! "${entry[1]}" =~ ^$duid ]]; then
557 557
                        warn "fstab refers to unknown DUID: \`$duid'"
b/snf-image-helper/disklabel.py
515 515
    parser.add_option("-l", "--list", action="store_true", dest="list",
516 516
                      default=False,
517 517
                      help="list the disklabel on the specified media")
518
    parser.add_option("--print-last", action="store_true", dest="last_part",
519
                      default=False,
518
    parser.add_option("--get-last-partition", action="store_true",
519
                      dest="last_part", default=False,
520 520
                      help="print the label of the last partition")
521
    parser.add_option("--print-last-linux", action="store_true",
522
                      dest="last_linux", default=False,
523
                      help="print the linux number for the last partition")
524
    parser.add_option("--print-duid", action="store_true", dest="duid",
521
    parser.add_option("--get-duid", action="store_true", dest="duid",
525 522
                      default=False,
526 523
                      help="print the disklabel unique identifier")
527 524
    parser.add_option("-d", "--enlarge-disk", type="int", dest="disk_size",
......
550 547
    if options.last_part:
551 548
        print "%c" % chr(ord('a') + disklabel.get_last_partition_id())
552 549

  
553
    if options.last_linux:
554
        part_id = disklabel.get_last_partition_id()
555
        # The linux kernel does not assign a partition for label 'c' that
556
        # describes the whole disk
557
        print part_id + (4 if part_id > 2 else 5)
558

  
559 550
    if options.disk_size is not None:
560 551
        disklabel.enlarge_disk(options.disk_size)
561 552

  
b/snf-image-helper/tasks/20FilesystemResizeUnmounted.in
37 37
fi
38 38

  
39 39
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
40
   part="${SNF_IMAGE_DEV}$(@scriptsdir@/disklabel.py --print-last-linux "$SNF_IMAGE_DEV")"
40
    bsd_part="$(@scriptsdir@/disklabel.py --get-last-partition "$SNF_IMAGE_DEV")"
41
    if [ "$bsd_part" = "b" ]; then
42
        warn "Last partition is swap space. Resizing ommited"
43
        exit 0
44
    fi
45

  
46
    part="${SNF_IMAGE_DEV}$(disklabel2linux "$bsd_part")"
41 47

  
42
   # If this fails the script will stop
43
   $DUMPFS_OPENBSD "$part" > /dev/null
48
    $DUMPFS_OPENBSD "$part" > /dev/null ||
49
        { warn "Filesystem is not UFS. Resizing ommited"; exit 0; }
44 50

  
45
   $GROWFS_OPENBSD -y "$part"
46
   exit 0
51
    $GROWFS_OPENBSD -y "$part"
52
    exit 0
47 53
fi
48 54

  
49 55
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = netbsd ]; then

Also available in: Unified diff