[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#738922: [PATCH 3/3] Use mke2fs instead of libparted



---
 commit.d/format_basicfilesystems | 86 ++++++++++++++++++++++++++++++++++------
 debian/changelog                 |  1 +
 2 files changed, 75 insertions(+), 12 deletions(-)

diff --git a/commit.d/format_basicfilesystems b/commit.d/format_basicfilesystems
index 8724526..060429f 100755
--- a/commit.d/format_basicfilesystems
+++ b/commit.d/format_basicfilesystems
@@ -48,19 +48,81 @@ for dev in $DEVICES/*; do
 			db_subst $template DEVICE $(humandev $(cat device))
 			case $filesystem in
 			    ext2)
-				options=''
-				if [ -f $id/usage ]; then
-					options="$options -T $(cat $id/usage)"
-				fi
-				if [ "$(udpkg --print-os)" = hurd ]; then
-					options="$options -b 4096 -I 128 -o hurd"
-				fi
-				if [ -z "$options" ]; then
-					name_progress_bar $template
-					open_dialog CREATE_FILE_SYSTEM $id $filesystem
-					read_line status
+# copied from partman-ext3
+					if [ -f $id/formatted ] && \
+						[ $id/formatted -nt $id/method ] && \
+						([ ! -f $id/filesystem ] || \
+						[ $id/formatted -nt $id/filesystem ]); then
+						continue
+					fi
+					log "Try to create file system for $dev/$id"
+					if [ -f $id/mountpoint ]; then
+						template=partman-basicfilesystems/progress_formatting_mountable
+						db_subst $template MOUNT_POINT "$(cat $id/mountpoint)"
+					else
+						template=partman-basicfilesystems/progress_formatting
+					fi
+					open_dialog PARTITION_INFO $id
+					read_line x1 x2 x3 x4 x5 device x6
 					close_dialog
-					sync
+
+					RET=''
+					db_metaget partman/filesystem_short/$filesystem description || RET=''
+					[ "$RET" ] || RET=$filesystem
+					db_subst $template TYPE "$RET"
+					db_subst $template PARTITION "$num"
+					db_subst $template DEVICE $(humandev $(cat device))
+
+					status=failed
+
+					if [ "$status" != OK ]; then
+						db_progress START 0 3 partman/text/formatting
+						db_progress INFO $template
+						db_progress SET 1
+						if [ -f $id/usage ]; then
+							usage="-T $(cat $id/usage)"
+						else
+							usage=''
+						fi
+						if log-output -t partman --pass-stdout \
+							mkfs.$filesystem $device $usage >/dev/null; then
+							sync
+							status=OK
+						else
+							status=failed
+						fi
+						db_progress STOP
+					fi
+					if [ "$status" = OK ]; then
+						label=''
+						if [ -f $id/label ]; then
+							label=$(cat $id/label | \
+								sed 's/\(................\).*/\1/g')
+						fi
+						if [ "$label" ]; then
+							log-output -t partman --pass-stdout \
+								tune2fs -L "$label" $device >/dev/null
+						fi
+						if [ -f $id/reserved_for_root ]; then
+							log-output -t partman --pass-stdout \
+								tune2fs -m $(cat $id/reserved_for_root) $device >/dev/null
+						fi
+					fi
+					if [ "$status" != OK ]; then
+						RET=''
+						db_metaget partman/filesystem_short/"$filesystem" description || RET=''
+						[ "$RET" ] || RET="$filesystem"
+						T=partman-basicfilesystems/create_failed
+						db_subst $T TYPE "$RET"
+						db_subst $T PARTITION "$num"
+						db_subst $T DEVICE $(humandev $(cat device))
+						db_input critical $T || true
+						db_go || true
+						exit 1
+					fi
+					>$id/formatted
+					;;
+
 
 			    fat16|fat32)
 				db_progress START 0 3 partman/text/formatting
diff --git a/debian/changelog b/debian/changelog
index 8a8fc5b..16790bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ partman-basicfilesystems (91) UNRELEASED; urgency=low
   * Remove check_swap, as there is no such thing as fscking swap
   * Use dosfstools to format and check fat filesystems rather than
     libparted.
+  * Use mke2fs instead of libparted
 
  -- Phillip Susi <psusi@ubuntu.com>  Wed, 12 Feb 2014 15:56:24 -0500
 
-- 
1.8.3.2


Reply to: