summaryrefslogtreecommitdiffstats
path: root/perl-install/any.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r--perl-install/any.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 1c0d9c368..68f7ac515 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -10,7 +10,9 @@ use vars qw(@users);
use common qw(:common :system :file :functional);
use commands;
use detect_devices;
+use partition_table qw(:types);
use fsedit;
+use fs;
use run_program;
use log;
@@ -253,6 +255,30 @@ sub shells {
grep { -x "$prefix$_" } map { chomp; $_ } cat_("$prefix/etc/shells");
}
+sub inspect {
+ my ($part, $prefix, $rw) = @_;
+
+ isMountableRW($part) or return;
+
+ my $dir = "/tmp/inspect_tmp_dir";
+
+ if ($part->{isMounted}) {
+ $dir = ($prefix || '') . $part->{mntpoint};
+ } elsif ($part->{notFormatted} && !$part->{isFormatted}) {
+ $dir = '';
+ } else {
+ mkdir $dir, 0700;
+ fs::mount($part->{device}, $dir, type2fs($part->{type}), !$rw);
+ }
+ my $h = before_leaving {
+ if (!$part->{isMounted} && $dir) {
+ fs::umount($dir);
+ unlink($dir)
+ }
+ };
+ $h->{dir} = $dir;
+ $h;
+}
1;