Handle hostnames with upper-case letters
[webmin.git] / webmin / edit_os.cgi
1 #!/usr/local/bin/perl
2 # edit_os.cgi
3 # Show the current OS according to Webmin, and some environment settings
4
5 require './webmin-lib.pl';
6 &ui_print_header(undef, $text{'os_title'}, "");
7 &get_miniserv_config(\%miniserv);
8
9 print $text{'os_desc3'},"<br>\n";
10 print $text{'os_desc2'},"<p>\n";
11
12 print &ui_form_start("change_os.cgi", "post");
13 print &ui_table_start($text{'os_header'}, undef, 2, [ "width=30%" ]);
14
15 # OS according to Webmin
16 print &ui_table_row($text{'os_webmin'},
17    &ui_select("type", $gconfig{'real_os_type'},
18         [ map { [ $_ ] } sort { $a cmp $b } &unique(map { $_->{'realtype'} }
19                                  &list_operating_systems()) ])." ".
20    &ui_textbox("version", $gconfig{'real_os_version'}, 10));
21
22 # Internal OS code
23 print &ui_table_row($text{'os_iwebmin'},
24     &ui_select("itype", $gconfig{'os_type'},
25         [ map { [ $_ ] } sort { $a cmp $b } &unique(map { $_->{'type'} }
26                                  &list_operating_systems()) ])." ".
27     &ui_textbox("iversion", $gconfig{'os_version'}, 10));
28
29 # Detected OS
30 %osinfo = &detect_operating_system();
31 if ($osinfo{'real_os_type'}) {
32         print &ui_table_row($text{'os_detect'},
33                 "$osinfo{'real_os_type'} $osinfo{'real_os_version'}\n".
34                 ($osinfo{'os_type'} ne $gconfig{'os_type'} ||
35                  $osinfo{'os_version'} ne $gconfig{'os_version'} ?
36                         "<br>".&ui_checkbox("update", 1, $text{'os_update'}) :
37                         ""));
38         }
39 else {
40         print &ui_table_row($text{'os_detect'},
41                             "<i>$text{'os_cannot'}</i>");
42         }
43
44 print &ui_table_hr();
45
46 # Search path
47 print &ui_table_row($text{'os_path'},
48         &ui_textarea("path",
49                      join("\n", split($path_separator, $gconfig{'path'})),
50                      5, 30)."<br>".
51         &ui_checkbox("syspath", 1, $text{'os_syspath'}, !$gconfig{'syspath'}));
52
53 # Shared library path
54 if ($gconfig{'ld_env'}) {
55         print &ui_table_row($text{'os_ld_path'},
56                 &ui_textarea("ld_path",
57                      join("\n", split($path_separator, $gconfig{'ld_path'})),
58                      5, 30));
59         }
60
61 # Perl search path
62 print &ui_table_row($text{'os_perllib'},
63         &ui_textarea("perllib",
64              join("\n", split(":", $miniserv{'perllib'})), 3, 30));
65
66 # Global environment variables
67 $atable = &ui_columns_start([ $text{'os_name'}, $text{'os_value'} ]);
68 $i = 0;
69 foreach $e (keys %miniserv) {
70         if ($e =~ /^env_(\S+)$/ &&
71             $1 ne "WEBMIN_CONFIG" && $1 ne "WEBMIN_VAR") {
72                 $atable .= &ui_columns_row([
73                         &ui_textbox("name_$i", $1, 20),
74                         &ui_textbox("value_$i", $miniserv{$e}, 30)
75                         ]);
76                 $i++;
77                 }
78         }
79 $atable .= &ui_columns_row([ &ui_textbox("name_$i", undef, 20),
80                              &ui_textbox("value_$i", undef, 30) ]);
81 $atable .= &ui_columns_end();
82 print &ui_table_row($text{'os_envs'}, $atable);
83
84 print &ui_table_end();
85 print &ui_form_end([ [ "", $text{'save'} ] ]);
86
87 &ui_print_footer("", $text{'index_return'});
88