3 BEGIN { push(@INC, ".."); };
8 # Returns a list of entries from the /etc/inittab file
13 open(INITTAB, $config{'inittab_file'});
18 if ($gconfig{'os_type'} eq 'aix') {
19 # A leading : indicates a comment on AIX
22 next if (/^\s*#\s*\$Header/i); # CVS header
26 local $nl = <INITTAB>;
32 if (/^(#*)\s*\$Id/ || /^(#*)\s*\/etc/ || /^(#*)\s*<id>/) {
35 elsif (/^(#*)\s*([^:]+):([^:]*):([^:]+):([^:]*)/) {
36 push(@rv, { 'id' => $2,
39 'comment' => $1 ne '',
40 'levels' => [ split(//, $3) ],
43 'index' => scalar(@rv) });
51 # create_inittab(&inittab)
52 # Adds an entry to /etc/inittab
55 &open_tempfile(INITTAB, ">>$config{'inittab_file'}");
56 &print_tempfile(INITTAB, $_[0]->{'comment'} ? "# " : "",
57 join(":", $_[0]->{'id'}, join("", @{$_[0]->{'levels'}}),
58 $_[0]->{'action'}, $_[0]->{'process'}),"\n");
59 &close_tempfile(INITTAB);
62 # modify_inittab(&inittab)
63 # Replaces an /etc/inittab entry
66 local $lref = &read_file_lines($config{'inittab_file'});
67 splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1,
68 ($_[0]->{'comment'} ? "# " : "").
69 join(":", $_[0]->{'id'}, join("", @{$_[0]->{'levels'}}),
70 $_[0]->{'action'}, $_[0]->{'process'}));
74 # delete_inittab(&inittab)
75 # Delete a single /etc/inittab entry
78 local $lref = &read_file_lines($config{'inittab_file'});
79 splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1);
85 return ( 0..6, "a", "b", "c" );
90 return ( [ "respawn", $text{ 'inittab_respawn' } ],
91 [ "wait", $text{ 'inittab_wait' } ],
92 [ "once", $text{ 'inittab_once' } ],
93 [ "ondemand", $text{ 'inittab_ondemand' } ],
94 [ "initdefault", $text{ 'inittab_initdefault' } ],
95 [ "sysinit", $text{ 'inittab_sysinit' } ],
96 [ "powerwait", $text{ 'inittab_powerwait' } ],
97 [ "powerfail", $text{ 'inittab_powerfail' } ],
98 [ "powerokwait", $text{ 'inittab_powerokwait' } ],
99 [ "powerfailnow", $text{ 'inittab_powerfailnow' } ],
100 [ "ctrlaltdel", $text{ 'inittab_ctrlaltdel' } ],
101 [ "kbdrequest", $text{ 'inittab_kbdrequest' } ],
102 [ "bootwait", $text{'inittab_bootwait'} ],
103 [ "boot", $text{'inittab_boot'} ],
104 [ "off", $text{'inittab_off'} ],