diff options
author | Matthew Booth <mbooth@redhat.com> | 2009-07-24 14:56:38 +0100 |
---|---|---|
committer | Matthew Booth <mbooth@redhat.com> | 2009-07-24 22:02:33 +0100 |
commit | 22eb7fc966bafebedfde437c9b9c9fb903a8bc35 (patch) | |
tree | 04eb23f18e813ee2d123ee94c23cdf5346330c30 /perl | |
parent | 3385d7a1bf6afb8508ce334c6231c35cbe2fbae0 (diff) | |
download | libguestfs-22eb7fc966bafebedfde437c9b9c9fb903a8bc35.tar.gz libguestfs-22eb7fc966bafebedfde437c9b9c9fb903a8bc35.tar.xz libguestfs-22eb7fc966bafebedfde437c9b9c9fb903a8bc35.zip |
Make read-only optional in mount_operating_system()
Diffstat (limited to 'perl')
-rw-r--r-- | perl/lib/Sys/Guestfs/Lib.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 5d48ba81..00a9bdb8 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1067,14 +1067,22 @@ sub mount_operating_system local $_; my $g = shift; my $os = shift; + my $ro = shift; # Read-only? + + $ro = 1 unless(defined($ro)); # ro defaults to 1 if unspecified my $mounts = $os->{mounts}; # Have to mount / first. Luckily '/' is early in the ASCII # character set, so this should be OK. foreach (sort keys %$mounts) { - $g->mount_ro ($mounts->{$_}, $_) - if $_ ne "swap" && $_ ne "none" && ($_ eq '/' || $g->is_dir ($_)); + if($_ ne "swap" && $_ ne "none" && ($_ eq '/' || $g->is_dir ($_))) { + if($ro) { + $g->mount_ro ($mounts->{$_}, $_) + } else { + $g->mount ($mounts->{$_}, $_) + } + } } } |