summaryrefslogtreecommitdiffstats
path: root/perl-install/network/smbnfs.pm
blob: d380aac0fdb9d9bce7691ddffdca989aa339ea98 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 comment_to_string {
    my ($class, $comment) = @_;
    $comment;
}
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) = @_;
    my $comment = $class->comment_to_string($e->{comment});
    ($e->{name} || $e->{ip}) . ($comment ? " ($comment)" : '');
}

sub to_fullstring {
    my ($class, $e) = @_;
    my $comment = $class->comment_to_string($e->{comment});
    $class->to_dev($e) . ($comment ? " ($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;