summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake/resize_ntfs.pm
blob: 30e860f6fb0759f89ac3529b6285cecbe6ce491c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package diskdrake::resize_ntfs;

use diagnostics;
use strict;

use run_program;
use common;


sub new {
    my ($type, $_device, $dev) = @_;
    bless { dev => $dev }, $type;
}

sub min_size {
    my ($o) = @_;
    my $r = run_program::get_stdout('ntfsresize', '-f', '-i', $o->{dev});
    $r =~ /minimal size: (\d+) KiB/ && $1 * 2 
}

sub resize {
    my ($o, $size) = @_;
    run_program::run_or_die('ntfsresize', '-ff', '-s' . int($size / 2) . 'ki', $o->{dev});
}

1;