Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image
Commits
1de1eff5
Commit
1de1eff5
authored
Feb 03, 2014
by
Nikos Skalkotos
Browse files
Cleanup disklabel.py
Remove --print-last-linux and change some other argument names
parent
83d0c566
Changes
3
Show whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh.in
View file @
1de1eff5
...
...
@@ -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 --
prin
t-duid "$device")"
duid="$(@scriptsdir@/disklabel.py --
ge
t-duid "$device")"
if [[ ! "${entry[1]}" =~ ^$duid ]]; then
warn "fstab refers to unknown DUID: \`$duid'"
...
...
snf-image-helper/disklabel.py
View file @
1de1eff5
...
...
@@ -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
(
"--
prin
t-last"
,
action
=
"store_true"
,
dest
=
"last_part"
,
default
=
False
,
parser
.
add_option
(
"--
ge
t-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
)
...
...
snf-image-helper/tasks/20FilesystemResizeUnmounted.in
View file @
1de1eff5
...
...
@@ -37,10 +37,16 @@ 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment