diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/DrakISO/Utils.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/MGA/DrakISO/Utils.pm b/lib/MGA/DrakISO/Utils.pm index f98e46d..c283d0d 100644 --- a/lib/MGA/DrakISO/Utils.pm +++ b/lib/MGA/DrakISO/Utils.pm @@ -33,7 +33,8 @@ use IO::Select; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw($sudo directory_usage glob__ run_ run_as_root run_in_root copy_or_link mount mount_system_fs umount_all_in_root); +our @EXPORT = qw($sudo directory_usage glob__ run_ run_as_root run_in_root copy_or_link + mk_dev_null rm_dev_null mount mount_system_fs umount_all_in_root); our $sudo = $> ? 'sudo' : ''; @@ -116,6 +117,20 @@ sub copy_or_link { or die "ERROR: couldn't link $src_file to $dst_file\n"; } +sub mk_dev_null { + my ($root) = @_; + $root or die; + return if -e $root . '/dev/null'; + run_as_root('mkdir', '-p', $root . '/dev'); + run_as_root('cp', '-a', '/dev/null', $root . '/dev'); +} + +sub rm_dev_null { + my ($root) = @_; + $root or die; + run_as_root('rm', $root . '/dev/null') if -e $root . '/dev/null'; +} + sub mount { my ($dst, $src, @o_options) = @_; mkdir_p($dst); |