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
49967718
Commit
49967718
authored
Mar 27, 2014
by
Nikos Skalkotos
Browse files
Merge branch 'feature-enlarge-netbsd'
parents
d9980653
a2a04353
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh.in
View file @
49967718
...
...
@@ -487,22 +487,19 @@ get_unattend() {
echo "$exists"
}
disklabel
2linux() {
local partition
i p
bsd
2linux() {
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() {
...
...
snf-image-helper/disklabel.py
View file @
49967718
This diff is collapsed.
Click to expand it.
snf-image-helper/tasks/10FixPartitionTable.in
View file @
49967718
...
...
@@ -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
...
...
snf-image-helper/tasks/20FilesystemResizeUnmounted.in
View file @
49967718
...
...
@@ -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
}
$(
disklabel
2linux
"
$bsd_part
"
)
"
part
=
"
${
SNF_IMAGE_DEV
}
$(
bsd
2linux
"
$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
...
...
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