PageRenderTime 45ms CodeModel.GetById 32ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

Unknown | 135 lines | 104 code | 31 blank | 0 comment | 0 complexity | af8b05bf99148981e2fb3f31512e1fd1 MD5 | raw file
  1<?xml version='1.0' encoding='UTF-8'?>
  3<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' ''>
  5<html xmlns='' xml:lang='en'>
  6  <head>
  7    <title>Geordi Readme</title>
  8  </head>
  9  <body>
 11    <h1>Geordi Readme</h1>
 13    <hr/><h2>Table of Contents</h2>
 15    <ul>
 16      <li><a href='#installation'>1. Installation</a></li>
 17      <li><a href='#running'>2. Running geordi</a></li>
 18      <li><a href='#localization'>3. Localization</a></li>
 19      <li><a href='#problems'>4. Known problems</a></li>
 20    </ul>
 22    <hr/><h2 id='installation'>1. Installation</h2>
 24    <h3>1.1&emsp;Prerequisites</h3>
 25    <ul>
 26      <li>An i386 or x86-64 machine</li>
 27      <li>GNU/Linux &ge; 2.6.34</li>
 28      <li>GCC/G++ &ge; 4.6</li>
 29      <li><a href=''>Boost</a> &ge; 1.33 (Only the headers are needed)</li>
 30      <li><a href=''>GHC</a> &ge; 7.4
 31        <!--<p>On Ubuntu, it is highly recommended to use GHC packages from the Ubuntu repositories. Use of's GHC packages may result in strange "g++: Virtual timer expired" errors.</p>
 32        <p>Some distributions package GHC libraries separately. If, when compiling, you get errors like “Could not find module "Control.Monad.State"”, look for separate mtl and network packages.</p> -->
 33      </li>
 34    </ul>
 35    <p>In addition, geordi depends on a number of <a href=''>Hackage</a> packages, but these will be downloaded, built, and installed automatically by <a href=''>cabal-install</a>.</p>
 37    <h3>1.2&emsp;Installing geordi</h3>
 38    <p>The easiest way to build and install geordi is with <a href=''>cabal-install</a>, part of the <a href=''>Haskell Platform</a>.</p>
 39    <p>In the geordi directory, say:</p>
 40    <pre>      cabal update
 41      cabal install</pre>
 42    <p>This will download, build, and install any missing dependencies from <a href=''>Hackage</a>, and will then build and install geordi (by default into <tt>$HOME/.cabal/</tt>).</p>
 44    <h3>1.3&emsp;Setting up a chroot</h3>
 46    <p>To set up a directory for geordi to chroot into when it starts, do the following:</p>
 48    <ol>
 49      <li><p>Edit <kbd>$PREFIX/share/geordi-0/compile-config</kbd> to your liking (where <kbd>$PREFIX</kbd> is the location where Cabal installed geordi, which defaults to <kbd>$HOME/.cabal/</kbd>). Check that the g++ path refers to the actual g++ binary, not some wrapper that adds output coloring or something.</p></li>
 50      <li><p>On Debian and Ubuntu, replace</p><pre>  group = "nobody"</pre><p>with</p><pre>  group = "nogroup"</pre><p> in <kbd>$PREFIX/share/geordi-0/jail-config</kbd>.</p></li>
 51      <li><kbd>geordi-mkrt</kbd><p>This creates <kbd>$PREFIX/share/geordi-0/rt</kbd>, which will be our chroot root, and copies various files into it that GCC needs in order to function.</p><p>If you ever make further modifications to <kbd>compile-config</kbd>, throw the old <kbd>rt</kbd> away and build a new one with <kbd>geordi-mkrt</kbd> (followed by <kbd>geordi-compile-prelude</kbd>).</p></li>
 52      <li><kbd>geordi-compile-prelude</kbd><p>This compiles the prelude files in <kbd>$PREFIX/share/geordi-0/prelude</kbd> to produce <kbd>$PREFIX/share/geordi-0/rt/{prelude.hpp.gch,prelude.a,}</kbd>.</p>
 53      </li>
 54    </ol>
 56    <p>Now try running</p><pre>  sudo geordi-local "&lt;&lt; 'x'"</pre>
 58    <p>If this complains about missing executables like <kbd>as</kbd> and <kbd>ld</kbd> which are present in a non-standard location in your <kbd>PATH</kbd>, try</p><pre>  sudo env PATH=$PATH geordi-local "&lt;&lt; 'x'"</pre>
 60    <p>If you get errors complaining about missing libraries and such (this can happen due to differing versions or configurations of gcc), try locating those on your system and manually copying them into the corresponding place in <kbd>$PREFIX/share/geordi-0/rt</kbd>.</p>
 62    <p>If your <kbd>compile-config</kbd> points to a custom-built gcc in a non-standard location <kbd>/foo/bar</kbd> and you get an error about <kbd>/t</kbd> missing some libraries, try adding <kbd>-Wl,-rlink,/foo/bar/lib</kbd> to <kbd>LINK_FLAGS</kbd> in <kbd>compile-config</kbd>.</p>
 64    <h3>1.4&emsp;Running the testsuite</h3>
 65    <p>A modest testsuite can now be run with <kbd>sudo geordi-testsuite</kbd> (recommended).</p>
 67    <hr/><h2 id='running'>2. Running geordi</h2>
 69    <h3 id='locally'>2.1&emsp;<kbd>geordi-local</kbd></h3>
 70    <p><kbd>geordi-local</kbd> lets one test snippets locally (that is, without connecting to any IRC server).</p>
 71    <p>Usage:&emsp;<kbd>sudo geordi-local [option]... [request]...</kbd></p>
 73    <p>Request syntax is described in the <a href=''>manual</a>, except that here the nickname (and colon/comma) must be omitted.</p>
 74    <p>Options:</p>
 75    <dl>
 76      <dt><kbd>-h</kbd> / <kbd>--help</kbd></dt>
 77      <dd><p>Display help and exit.</p></dd>
 78    </dl>
 79    <p>If any requests are specified, they are evaluated and their results are shown. If the first request starts with a request option, interject “<kbd>--</kbd>” to prevent it from being interpreted as a command option.</p>
 80    <p>If no requests are specified, the program goes into a Read-Eval-Print-Loop.</p>
 82    <h3 id='ircbot'>2.2&emsp;<kbd>geordi-irc</kbd></h3>
 84    <p>Usage:&emsp;<kbd>sudo geordi-irc [option]...</kbd></p>
 86    <p>Starting an IRC bot with root permissions should make one seriously nervous. Geordi requires root permissions only because <a href=''>chroot(2)</a> does. Geordi chroots into <kbd>rt</kbd> as one of the first things it does on startup, and changes to the user and group specified in jail-config before it starts responding to IRC messages.</p>
 88    <p>Options:</p>
 89    <dl>
 90      <dt><kbd>-c &lt;file></kbd> / <kbd>--config &lt;file></kbd></dt>
 91      <dd><p>Load bot configuration from &lt;file> instead of <kbd>irc-config</kbd>.</p></dd>
 92      <dt><kbd>-h</kbd> / <kbd>--help</kbd></dt>
 93      <dd><p>Display help and exit.</p></dd>
 94    </dl>
 96    <h4 id='nickserv'>NickServ identification</h4>
 97    <p>To have the bot identify to NickServ, change the following line in <kbd>irc-config</kbd>:</p>
 98    <pre>  , nick_pass = Nothing</pre>
 99    <p>into:</p>
100    <pre>  , nick_pass = Just "mypassword"</pre>
102    <h4>Nickless requests</h4>
103    <p>To have the bot respond to nickless requests (e.g. "<kbd>&lt;&lt; 3</kbd>") in channels #foo, #bar, and #bas, use:</p>
104    <pre>  , allow_nickless_requests_in = ["#foo", "#bar", "#bas"]</pre>
106    <h4 id='reconnect'>Auto-reconnect</h4>
107    <p>Geordi does not auto-reconnect. For that, just use something like</p><pre>  while true; do geordi-irc; sleep 120; done</pre>
109    <h4 id='multinetwork'>Connecting to multiple networks</h4>
110    <p>Make config files for the different networks. Then run one <kbd>geordi-irc</kbd> instance for each network, passing -c arguments pointing to the respective config files. The <kbd>rt</kbd> directory will be safely shared.</p>
112    <h4>Censoring phrases</h4>
113    <p>Some networks automatically kick or ban clients that utter certain phrases (like botnet commands). To prevent a geordi bot from uttering these, list regexes for them in irc-config. E.g.:</p>
114    <pre>  , censor = ["some naughty phrase", "some wicked utterance"]</pre>
116    <hr/><h2 id='localization'>3. Localization</h2>
117    <p>To get compiler diagnostics (and some (but not all) other geordi messages) in a locale of your choice, copy the following into <kbd>rt</kbd> (preserving paths, for example using <kbd>cp --parents</kbd>):</p>
118    <ul>
119      <li>/usr/lib/locale/foo_BAR.utf8/*</li>
120      <li>/usr/share/locale/foo/LC_MESSAGES/{cpplib,gcc,libc,libstdc++,opcodes}.mo</li>
121    </ul>
122    <p>These paths might differ somewhat on your system.</p>
123    <p>You may need to install a separate GCC locales package or other kind of language pack for your distro, to get the files above.</p>
124    <p>Furthermore, not all of the files above may be available for your locale; copy those that are.</p>
125    <p>Additionally, the LC_ALL environment variable must be set to foo_BAR.utf8 when geordi is started. Note that sudo clears environment variables by default, so either use</p><pre>  sudo -E geordi-...</pre><p>or use</p><pre>  sudo env LC_ALL=foo_BAR.utf8 geordi-...</pre>
127    <hr/><h2 id='problems'>4. Known problems</h2>
128    <ul>
129      <li>
130        Because <kbd>geordi-irc</kbd> connects as root, IRC servers that query ident may get a root response and may decide to reject the connection. (Quakenet is known to do this.)
131      </li>
132    </ul>
134  </body>