Handle hostnames with upper-case letters
[webmin.git] / init / fix_action.cgi
1 #!/usr/local/bin/perl
2 # fix_action.cgi
3 # Convert an action from a run-level file to a proper action in init.d
4
5 require './init-lib.pl';
6 $access{'bootup'} == 1 || &error("You are not allowed to edit bootup actions");
7 $rl = $ARGV[0];
8 $ss = $ARGV[1];
9 $num = $ARGV[2];
10 $ac = $ARGV[3];
11
12 $oldfile = &runlevel_filename($rl, $ss, $num, $ac);
13 $newfile = &action_filename($ac);
14 while(-r $newfile) {
15         if ($ac =~ /^(.*)_([0-9]+)$/) { $ac = "$1_".($2+1); }
16         else { $ac = $ac."_1"; }
17         $newfile = &action_filename($ac);
18         }
19 `mv $oldfile $newfile`;
20 &add_rl_action($ac, $rl, $ss, $num);
21 &redirect("edit_action.cgi?0+$ac");
22