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