aboutsummaryrefslogtreecommitdiffstats
path: root/chapter09/usage6.xml
blob: ae1ea7f517e5b2795da051a844e2d4240dd974d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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">
  <!ENTITY site               SYSTEM "../appendices/rc.site.script">
  %general-entities;
]>

<sect1 id="ch-config-usage" revision="s6">
  <?dbhtml filename="usage.html"?>

  <title>S6 Usage and Configuration</title>

  <para>Some information about S6 in general and in detail...</para>
  
  <sect2>
    <title>Terminology</title>

    <para>
      S6 does not look that trivial on the first view. Some
      clarification on the terminology of S6 might help to understand
      what is talked about.
    </para>

    <itemizedlist>
      <listitem>
	<para>service directory</para>
	<para>
          A directory, where your service definitions are
	  stored. That is the direcory where all the directories
	  containing <filename>type</filename>, <filename>up</filename>,
	  <filename>down</filename> and <filename>dependencies</filename>
	  resides in. In the service directory can be much more
	  service definitions be stored than you might actually are
	  going to use.
	</para>
      </listitem>
      
      <listitem>
	<para>scan directory</para>
	<para>
          Pretty much same structure as a <emphasis>service directory</emphasis>
          but it contains only that services which are used on your
          system. The scandir can contain symbolic links to services
          in the <emphasis>service directory</emphasis>.
	</para>
      </listitem>
    </itemizedlist>
    
  </sect2>
  
  <sect2>
    <title>The boot scripts</title>
    
    <para>Now setup some essential scripts for booting.</para>

    <para>
      After init has been started, the s6 rc.init file is read.
      The file can be found in <filename class="directory">/etc/s6-linux-init/skel</filename>.
      This file can be used to start the S6 service manager as well
      as optionally other service managers. To enable s6-rc, execute
      following command to uncomment the respective line:
    </para>

<screen><userinput>sed -e "s/^# s6-rc-init/s6-rc-init/" \
    -i /etc/s6-linux-init/skel/rc.init</userinput></screen>

    <note>
      <para>
        Whenever you change files in the skel directory, it is
        required to reinstall them using the <filename>s6-linux-init-maker</filename>
        script.
      </para>
      <para>
        Execute the following commands to rebuild the files.
      </para>
    </note>

<!--
  Following setup is taken from
    https://skarnet.org/software/s6-linux-init/quickstart.html
  It builds the required programs (init, reboot, ...).
  
  The system is bootable with this config, but it has
  * only one tty (tty1)
  * root-fs is mounted R/O
  * no virtual filesystems (like /proc) are mounted
  * messages breaks thru to console
  
  ... but it boots ;-)
-->  
    <para>Make sure that the configuration directory exists:</para>
  
<screen><userinput>mkdir -p /etc/s6-linux-init</userinput></screen>  

    <para>Setup a temporary directory name (the directory itself
    must not exist):</para>

<screen><userinput>tmpdir=$(mktemp -d -u)</userinput></screen>  

    <para>Create essential programs and move them to a
      directory representing the current setup:</para>

<screen><userinput>s6-linux-init-maker -1 -G "/sbin/agetty -J 38400 tty1" $tmpdir
mv $tmpdir /etc/s6-linux-init/current
</userinput></screen>  

    <para>Install the essential programs in the file system:</para>

<screen><userinput>cp -av /etc/s6-linux-init/current/bin/* /sbin/</userinput></screen>  

  </sect2>
  
</sect1>