Show network config format in UI

This commit is contained in:
Jamie Cameron
2020-12-28 14:30:39 -08:00
parent fac6ada7e4
commit ec3c00090d
3 changed files with 25 additions and 3 deletions

View File

@@ -3,9 +3,18 @@
# Display a menu of various network screens
require './net-lib.pl';
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
&help_search_link("ifconfig hosts resolve.conf nsswitch.conf", "man"));
# Show friendly name for network config file format
($mode, $ver) = split(/\//, $net_mode);
$mdesc = $text{'index_mode_'.$mode};
if (!$mdesc && $mode =~ /^(.*)-linux$/) {
$mdesc = ucfirst($1)." Linux";
}
$mdesc ||= $mode;
$desc = &text('index_mode', $mdesc);
&ui_print_header($desc, $text{'index_title'}, "", undef, 1, 1, 0,
&help_search_link("ifconfig hosts resolve.conf nsswitch.conf", "man"));
$zone = &running_in_zone() || &running_in_vserver();
foreach $i ('ifcs', 'routes', 'dns', 'hosts',
($config{'ipnodes_file'} ? ('ipnodes') : ( ))) {

View File

@@ -7,6 +7,15 @@ index_delete2=Delete Selected Interfaces
index_delete3=Delete and Apply Selected Interfaces
index_apply2=Apply Selected Interfaces
index_vmin=Virtualmin
index_mode=Network config type: $1
index_mode_netplan=Netplan
index_mode_cygwin=Cygwin
index_mode_freebsd=FreeBSD
index_mode_macos=MacOS
index_mode_netbsd=NetBSD
index_mode_openbsd=OpenBSD
index_mode_solaris=Solaris
index_mode_windows=Windows
ifcs_title=Network Interfaces
ifcs_now=Active Now

View File

@@ -7,28 +7,32 @@ use WebminCore;
%access = &get_module_acl();
$access{'ipnodes'} = $access{'hosts'};
# XXX detect this automatically rather than using a bunch of links?
if (-r "$module_root_directory/$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl") {
do "$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl";
$net_mode = $gconfig{'os_type'}."/".$gconfig{'os_version'};
}
elsif ($gconfig{'os_type'} eq 'suse-linux' &&
$gconfig{'os_version'} >= 9.2) {
# Special case for SuSE 9.2+
do "$gconfig{'os_type'}-9.2-ALL-lib.pl";
$net_mode = $gconfig{'os_type'}."/9.2";
}
elsif ($gconfig{'os_type'} eq 'slackware-linux' &&
$gconfig{'os_version'} >= 9.1) {
# Special case for Slackware 9.1+
do "$gconfig{'os_type'}-9.1-ALL-lib.pl";
$net_mode = $gconfig{'os_type'}."/9.1";
}
elsif ($gconfig{'os_type'} eq 'debian-linux' &&
&has_command("netplan") &&
-d "/etc/netplan") {
# Special case for newer Ubuntu versions
do "netplan-lib.pl";
$net_mode = "netplan";
}
else {
do "$gconfig{'os_type'}-lib.pl";
$net_mode = $gconfig{'os_type'};
}
# list_hosts()