3 # Rewrites the hostconfig file
5 # Written by Michael A. Peters <mpeters@mac.com>
8 require './init-lib.pl';
9 $access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
12 if ( $in{'choice'} eq "custom" ) {
13 $setting = $in{'custom'};
16 $setting = $in{'choice'};
19 if ( $setting =~ /^\%22(.*)\%22$/ ) {
24 if ( $setting =~ /[ ]/ ) {
25 $setting = "\"$setting\"";
28 # not all possibile blunders are fixed, but at least intelligently
31 $setting = "$in{'action'}=$setting";
33 $hostc = $config{'hostconfig'};
34 # modify and write the hostconfig file
36 &lock_file($config{'hostconfig'});
37 open(LOCAL, "$hostc");
40 foreach $line (@old) {
41 $line =~ s/^$in{'action'}=(.*)$/$setting/;
45 &open_tempfile(LOCAL, "> $config{'hostconfig'}");
46 &print_tempfile(LOCAL, @new);
47 &close_tempfile(LOCAL);
48 &unlock_file($config{'hostconfig'});
49 &webmin_log("hostconfig", undef, undef, "\%in");