Enable %age complete display from e2fsck command (#697662)

Enable the text progress bar and percentage complete from the e2fsck
command.  Looks like:

    # e2fsck -f -y -v -C 0 /dev/sda8
    e2fsck 1.41.12 (17-May-2010)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    test8: |=========================================               / 73.6%

Note that e2fsck deliberately brackets the progress bar with control-A
and control-B characters when it detects that it is not being run from a
terminal so that logsave(8) can exclude the progress bar from being
written to a log file.  As GParted doesn't run e2fsck via a pty it
receives these control characters.  Ignore them.

References:
Change e2fsck to bracket its progress bar output with ctrl-A and ctrl-B
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=bc34d6be65cb93a65451ad209cfea2f98b03fd22

Don't print ^A and ^B chars when e2fsck is talking directly to a tty
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=54a31a3b2e432c124aa03442f2983c4f4d4a974c

Closes Bug #697662 - Do not hide the progress of the tools used
This commit is contained in:
Mike Fleetwood 2013-06-16 15:37:59 +01:00 committed by Curtis Gedak
parent a8b699d896
commit 59a22673da
2 changed files with 4 additions and 1 deletions

View File

@ -64,6 +64,9 @@ bool PipeCapture::OnReadable( Glib::IOCondition condition )
buff += '\n';
backcount = 0;
}
else if (*s == '\x01' || *s == '\x02' )
//Skip Ctrl-A and Ctrl-B chars e2fsck uses to bracket the progress bar
continue;
else {
if (backcount) {
buff.erase( buff.length() - backcount, backcount );

View File

@ -194,7 +194,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
bool ext2::check_repair( const Partition & partition, OperationDetail & operationdetail )
{
exit_status = execute_command( "e2fsck -f -y -v " + partition.get_path(), operationdetail,
exit_status = execute_command( "e2fsck -f -y -v -C 0 " + partition.get_path(), operationdetail,
false, true );
//exitstatus 256 isn't documented, but it's returned when the 'FILE SYSTEM IS MODIFIED'