Bug#636400: please export create_new_partition()
Package: partman-partitioning
Version: 82
Severity: wishlist
Tags: patch
Please consider exporting create_new_partition() so that partman-zfs (and maybe
others) can use it. Currently it has to copy the entire function, see:
http://anonscm.debian.org/gitweb/?p=d-i/partman-zfs.git;a=commitdiff;h=b50a75d0fc9a6ac039df997364f69e5100e56802#patch2
Two things would be needed:
- Fix the parameter passing problem, and allow override of default_fs.
- Move this function to a separate file, which can be sourced without
collateral effects.
Attached patch takes care of the first one.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/free_space/new/do_option b/free_space/new/do_option
index 58b1ee0..e1e5eec 100755
--- a/free_space/new/do_option
+++ b/free_space/new/do_option
@@ -119,15 +119,13 @@ ask_for_place () {
db_get partman-partitioning/new_partition_place
place="$RET"
fi
- if create_new_partition; then break; fi
+ if create_new_partition $type $freeid $place $size; then break; fi
noninteractive="return 1"
done
}
create_new_partition () {
- # $type, $freeid, $place, and $size are global, passed down from
- # elsewhere. TODO: these should really be function arguments.
- open_dialog NEW_PARTITION $type ext2 $freeid $place $size
+ open_dialog NEW_PARTITION $1 ext2 $2 $3 $4
local num id fs mp mplist mpcurrent numparts device
id=''
read_line num id x1 x2 x3 x4 x5
@@ -145,8 +143,12 @@ create_new_partition () {
db_progress START 0 $numparts partman/text/please_wait
db_progress INFO partman-partitioning/new_state
- db_get partman/default_filesystem
- default_fs="$RET"
+ if [ "$5" ]; then
+ default_fs="$5"
+ else
+ db_get partman/default_filesystem
+ default_fs="$RET"
+ fi
if [ "$id" ] && [ -f "../../$default_fs" ]; then
# make better defaults for the new partition
mkdir -p $id
Reply to: