Handle hostnames with upper-case letters
[webmin.git] / init / delete_action.cgi
1 #!/usr/local/bin/perl
2 # delete_action.cgi
3 # Delete an existing action and remove it from all the runlevels
4
5 require './init-lib.pl';
6 &ReadParse();
7 $access{'bootup'} == 1 || &error($text{'save_ecannot'});
8
9 if ($in{type} == 0) {
10         # Deleting a normal action
11         foreach (&action_levels('S', $in{action})) {
12                 /^(\S+)\s+(\S+)\s+(\S+)$/;
13                 &delete_rl_action($in{action}, $1, 'S');
14                 }
15         foreach (&action_levels('K', $in{action})) {
16                 /^(\S+)\s+(\S+)\s+(\S+)$/;
17                 &delete_rl_action($in{action}, $1, 'K');
18                 }
19         $file = &action_filename($in{action});
20         }
21 elsif ($in{type} == 1) {
22         # deleting an odd action
23         $file = &runlevel_filename($in{runlevel}, $in{startstop},
24                                    $in{number}, $in{action});
25         }
26 if (&has_command("insserv")) {
27         &system_logged("insserv -r ".quotemeta($in{action}));
28         }
29 &unlink_logged("/etc/init/$in{'action'}.conf");
30 &unlink_logged($file);
31 &webmin_log('delete', 'action', $in{'action'});
32 &redirect("");
33