<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>

<sect1 id="ch-boot-sysvinit" role="wrap">
  <?dbhtml filename="sysvinit.html"?>

  <title>Sysvinit-&sysvinit-version;</title>

  <indexterm zone="ch-boot-sysvinit">
    <primary sortas="a-Sysvinit">Sysvinit</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>The Sysvinit package contains programs for controlling the startup,
    running, and shutdown of the system.</para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of Sysvinit</title>

    <para os="p1">Apply a patch to prevent installation of unneeded programs,
    and allow Sysvinit to be installed in
    <filename class="directory">/tools</filename>:</para>

<screen os="p2"><userinput>patch -Np1 -i ../sysvinit-&sysvinit-version;-tools_updates-1.patch</userinput></screen>

    <para os ="c">Compile the package:</para>

<screen os="ac"><userinput>make -C src clobber
make -C src CC="${CC}"</userinput></screen>

   <para os="e">Install the package:</para>

<screen os="ad"><userinput>make -C src ROOT=/tools install</userinput></screen>

  </sect2>

  <sect2 id="conf-tools-sysvinit" role="configuration">
    <title>Configuring Sysvinit</title>

    <indexterm zone="conf-tools-sysvinit">
      <primary sortas="a-Sysvinit">Sysvinit</primary>
      <secondary>configuring</secondary>
    </indexterm>

    <indexterm zone="conf-tools-sysvinit">
      <primary sortas="e-/etc/inittab">/etc/inittab</primary>
    </indexterm>

    <para>Create a new file <filename>/tools/etc/inittab</filename> by running the
    following:</para>

<screen><userinput>cat &gt; /tools/etc/inittab &lt;&lt; "EOF"
<literal># Begin /tools/etc/inittab

id:3:initdefault:

si::sysinit:/tools/etc/rc.d/init.d/rc sysinit

l0:0:wait:/tools/etc/rc.d/init.d/rc 0
l1:S1:wait:/tools/etc/rc.d/init.d/rc 1
l2:2:wait:/tools/etc/rc.d/init.d/rc 2
l3:3:wait:/tools/etc/rc.d/init.d/rc 3
l4:4:wait:/tools/etc/rc.d/init.d/rc 4
l5:5:wait:/tools/etc/rc.d/init.d/rc 5
l6:6:wait:/tools/etc/rc.d/init.d/rc 6

ca:12345:ctrlaltdel:/tools/sbin/shutdown -t1 -a -r now

su:S016:once:/tools/sbin/sulogin
</literal>
EOF</userinput></screen>

    <para>The following command adds the standard virtual terminals to
    <filename>/tools/etc/inittab</filename>. If your system only has a serial
    console skip the following command:</para>

<screen><userinput>cat &gt;&gt; /tools/etc/inittab &lt;&lt; "EOF"
<literal>1:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty1 9600
2:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty2 9600
3:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty3 9600
4:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty4 9600
5:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty5 9600
6:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty6 9600
</literal>
EOF</userinput></screen>

    <para>If your system has a serial console, run the following command to add
    the entry to <filename>/tools/etc/inittab</filename>.</para>

<screen><userinput>cat &gt;&gt; /tools/etc/inittab &lt;&lt; "EOF"
<literal>c0:12345:respawn:/tools/sbin/agetty --noclear 115200 ttyS0 vt100
</literal>
EOF</userinput></screen>

   <para>Finally, add the end line to <filename>/tools/etc/inittab</filename>.</para>

<screen><userinput>cat &gt;&gt; /tools/etc/inittab &lt;&lt; "EOF"
<literal># End /tools/etc/inittab</literal>
EOF</userinput></screen>

    <para>The <parameter>-I '\033(K'</parameter> option tells
    <command>agetty</command> to send this escape sequence to the terminal
    before doing anything else. This escape sequence switches the console
    character set to a user-defined one, which can be modified by running
    the <command>setfont</command> program. Sending this
    escape sequence is necessary for people who use non-ISO 8859-1 screen
    fonts, but it does not affect native English speakers.</para>

  </sect2>

  <sect2 id="contents-sysvinit" role="content">
    <title>Contents of Sysvinit</title>

    <segmentedlist>
      <segtitle>Installed programs</segtitle>

      <seglistitem>
        <seg>bootlogd, fstab-decode, halt, init, killall5,
        poweroff (link to halt), reboot (link to halt), runlevel,
        shutdown, and telinit (link to init)</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="bootlogd">
        <term><command>bootlogd</command></term>
        <listitem>
          <para>Logs boot messages to a log file</para>
          <indexterm zone="ch-boot-sysvinit bootlogd">
            <primary sortas="b-bootlogd">bootlogd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="fstab-decode">
        <term><command>fstab-decode</command></term>
        <listitem>
          <para>Runs a command with fstab-encoded arguments</para>
          <indexterm zone="ch-boot-sysvinit fstab-decode">
            <primary sortas="b-fstab-decode">fstab-decode</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="halt-sysv">
        <term><command>halt</command></term>
        <listitem>
          <para>Normally invokes <command>shutdown</command> with the
          <parameter>-h</parameter> option, except when already in run-level 0,
          then it tells the kernel to halt the system; it notes in the
          file <filename>/var/log/wtmp</filename> that the system is being
          brought down</para>
          <indexterm zone="ch-boot-sysvinit halt-sysv">
            <primary sortas="b-halt-sysv">halt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="init-sysv">
        <term><command>init</command></term>
        <listitem>
          <para>The first process to be started when the kernel has initialized
          the hardware which takes over the boot process and starts all the
          proceses it is instructed to</para>
          <indexterm zone="ch-boot-sysvinit init-sysv">
            <primary sortas="b-init-sysv">init</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="killall5">
        <term><command>killall5</command></term>
        <listitem>
          <para>Sends a signal to all processes, except the processes in its own
          session so it will not kill the shell running the script that called
          it</para>
          <indexterm zone="ch-boot-sysvinit killall5">
            <primary sortas="b-killall5">killall5</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="poweroff-sysv">
        <term><command>poweroff</command></term>
        <listitem>
          <para>Tells the kernel to halt the system and switch off the computer
          (see <command>halt</command>)</para>
          <indexterm zone="ch-boot-sysvinit poweroff-sysv">
            <primary sortas="b-poweroff-sysv">poweroff</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="reboot-sysv">
        <term><command>reboot</command></term>
        <listitem>
          <para>Tells the kernel to reboot the system (see
          <command>halt</command>)</para>
          <indexterm zone="ch-boot-sysvinit reboot-sysv">
            <primary sortas="b-reboot-sysv">reboot</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="runlevel-sysv">
        <term><command>runlevel</command></term>
        <listitem>
          <para>Reports the previous and the current run-level, as noted in
          the last run-level record in <filename>/run/utmp</filename></para>
          <indexterm zone="ch-boot-sysvinit runlevel-sysv">
            <primary sortas="b-runlevel-sysv">runlevel</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="shutdown-sysv">
        <term><command>shutdown</command></term>
        <listitem>
          <para>Brings the system down in a secure way, signaling all processes
          and notifying all logged-in users</para>
          <indexterm zone="ch-boot-sysvinit shutdown-sysv">
            <primary sortas="b-shutdown-sysv">shutdown</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="telinit-sysv">
        <term><command>telinit</command></term>
        <listitem>
          <para>Tells <command>init</command> which run-level to change to</para>
          <indexterm zone="ch-boot-sysvinit telinit-sysv">
            <primary sortas="b-telinit-sysv">telinit</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
