diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-02-14 20:39:15 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-02-14 20:39:15 +0000 |
commit | 8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b (patch) | |
tree | bf3b8bec65d6e3b16ea822aab9a01a470f90b97b /perl-install/network/smbnfs.pm | |
parent | 036bfccc67f49edf02b6fdb0153036ebe0353989 (diff) | |
download | drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.gz drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.bz2 drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.xz drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.zip |
cleaner & OOed code, with more code sharing
Diffstat (limited to 'perl-install/network/smbnfs.pm')
-rw-r--r-- | perl-install/network/smbnfs.pm | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/perl-install/network/smbnfs.pm b/perl-install/network/smbnfs.pm new file mode 100644 index 000000000..1958ce167 --- /dev/null +++ b/perl-install/network/smbnfs.pm @@ -0,0 +1,50 @@ +package network::smbnfs; # $Id$ + +use strict; +use diagnostics; + + +sub new { + my ($class, $v) = @_; + bless($v || {}, $class); +} + +sub server_to_string { + my ($class, $server) = @_; + $server->{name} || $server->{ip}; +} +sub to_dev { + my ($class, $e) = @_; + $class->to_dev_raw($class->server_to_string($e->{server}), $e->{name} || $e->{ip}); +} +sub to_string { + my ($class, $e) = @_; + ($e->{name} || $e->{ip}) . ($e->{comment} ? " ($e->{comment})" : ''); +} + +sub to_fullstring { + my ($class, $e) = @_; + $class->to_dev($e) . ($e->{comment} ? " ($e->{comment})" : ''); +} +sub to_fstab_entry_raw { + my ($class, $e, $type) = @_; + my $fs_entry = { device => $class->to_dev($e), type => $type }; + fs::set_default_options($fs_entry); + $fs_entry; +} + +sub raw_check { + my ($class, $in, $pkg, $file) = @_; + if (! -e $file) { + $in->ask_okcancel('', _("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return; + $in->do_pkgs->install($pkg); + } + if (! -e $file) { + $in->ask_warn('', _("Mandatory package %s is missing", $pkg)); + return; + } + 1; +} + +1; + |