<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
  <!ENTITY moddir "/usr/share/modass">
  <!ENTITY cachedir "/var/cache/modass">
]>

<!--
     Note about indentation:
      - Inside the root <refentry>, a single margin space.
      - Everywhere else, two-space indentation.
-->

<refentry>
 <docinfo>
   <address><email>module-assistant@packages.debian.org</email></address>
   <author><firstname>Eduard</firstname> <surname>Bloch</surname></author>
   <copyright><year>2003</year> <holder>Eduard Bloch</holder></copyright>
   <date>06 September 2003</date>
 </docinfo>
 <refmeta>
   <refentrytitle>module-assistant</refentrytitle>
   <manvolnum>8</manvolnum>
 </refmeta>

 <!-- Man page title -->
 <refnamediv>
   <refname>module-assistant</refname>
   <refpurpose>manage kernel modules packages</refpurpose>
 </refnamediv>

 <!-- Arguments -->
 <refsynopsisdiv>
   <cmdsynopsis>
     <command>module-assistant</command>
     <arg><option>-fihnqstv</option></arg>
     <arg><option>-k <replaceable>source/headers directory</replaceable></option></arg>
     <arg><option>-l <replaceable>kernel versions</replaceable></option></arg>
     <group choice=req>
       <arg>update</arg>
       <arg>search</arg>
       <arg>prepare</arg>
       <arg>auto-install</arg>
       <arg>list</arg>
       <arg>list-available</arg>
       <arg>list-installed</arg>
       <arg>auto-unpacked</arg>
       <arg>get</arg>
       <arg>build</arg>
       <arg>install</arg>
       <arg>clean</arg>
       <arg>purge</arg>
       <arg>fakesource</arg>
     </group>
     <arg choice="opt" rep="repeat"><replaceable>pkg</replaceable></arg>
   </cmdsynopsis>
   <cmdsynopsis>
     <command>m-a ...</command>
   </cmdsynopsis>
 </refsynopsisdiv>

 <refsect1><title>Description</title>
   <para>
   <command/module-assistant/ is the command-line tool for handling
   module-source packages that have been prepared for the Debian
   distribution. It helps users to build and install module package(s)
   easily for one or more custom kernels.

   <para>
   Unless the <option/-h/, or <option/--help/ option is given, one of
   the commands below should be present to invoke a function
   explicitly. If no (or no valid) command is specified and the
   <literal/dialog/ tool is available, a simple graphical user
   interface will pop up and guide you trough the available
   functionality.

   <para>
   NOTE: don't even think about using some random linux-source-x.y.z
   package contents (or linux-x.y.z tarball from the Internet) to
   specify the kernel source for your currently running
   kernel. <command>Don't!</command> Those source is not exactly what
   have been used to build the running kernel and its configuration
   most likely does not match yours. You need the configured kernel
   source directory or at least the derived linux-headers-... package
   containing the kernel configuration for the exact kernel version
   (complete version string).  If you do not understand anything of
   the above, run "m-a prepare" and/or look at the description and
   contents of some linux-headers-... package.  Please run
   the <command>module-assistant prepare</command> command once before
   you do anything else.

   <para>
   For some packages, linux-headers (reduced source) is not
   enough. You will have the choice to run a completely customized
   kernel, or to recreate the source that have been used to build the
   current one. The <command/fakesource/ function may be useful, see
   below.

   <para>
   In order to configure a kernel source properly, you need to make
   sure that the file version.h is generated. To get it, configure the
   options as usual (<command>make menuconfig</command> etc.)  and
   run <command>make dep</command> (for kernel 2.4.x) or <command>make
   prepare</command> (for newer ones).
 </refsect1>

 <refsect1><title>Commands</title>
   <para>
   Most commands require a specification of the package names that
   they should be applied on.  <command/pkg/ can be a single word
   (package name) or multiple names. The word <command/all/ will be
   expanded to the list of all available packages, the word
   <command/alli/ to the list of currently installed (source) packages
   and the word <command/allu/ will be expanded to the list of
   packages that seem to be installed and unpacked in the base source
   directory.  If a source package with the given name is not
   available, <command/module-assistant/ (abbreviated: <command/m-a/)
   will extend the package name with the popular suffixes like
   -kernel, -driver, -module, -source and combinations of them.

   <para>
   Multiple commands can be specified in one invocation,
   eg. "<command/m-a clean,get,build arla cdfs/" is the short way to
   write "module-assistant clean arla-modules-source ;
   module-assistant clean cdfs-src ; module-assistant get
   arla-modules-source cdfs-src ; module-assistant build
   arla-modules-source cdfs-src" (or similar).

   <para>
   If you do not like the dialog/whiptail GUI, feel free to use the
   <option/-t/ switch to disable it.

   <para>
   <variablelist>
     <varlistentry><term>update</term>
     <listitem><para>
     <literal/update/ is used to resynchronize the version index files
     from their sources. This happens with helper scripts provided by
     the packages. <command/module-assistant/ has a default built-in
     list of the packages that it should look for but other packages
     can be registered by <command/module-assistant/ if the maintainer
     adds the helper script.
     </varlistentry>

     <varlistentry><term>prepare</term>
     <listitem><para>
     Tries to determine the name of the required linux-headers
     package (either the one matching the currently running kernel or
     for the versions specified with -l), installs it if needed and
     creates the <literal>/usr/src/linux</literal> symlink if
     needed. Also installs the build-essential package to ensure that
     a sane compiler environment is established.
     </varlistentry>

     <varlistentry><term>fakesource</term>
     <listitem><para>
     Experimental function which tries to determine the name of the
     required/compatible linux-source package, installs it, modifies
     the Makefile to look like the original source and runs
     configuration routines as needed. Warning: DO NOT RELY ON THE
     RESULTING SOURCE. It may be very different from the original
     version.
     </varlistentry>

     <varlistentry><term>list | list-available | la</term>
     <listitem><para>
     <literal/list-available/ (abbreviated with <literal/la/) presents
     a list of details about specified packages, including installed
     version, installable versions and recently built binary
     packages. If the package names are omitted, shows all known
     packages. With <option/-v/, prints long package paths.
     </varlistentry>

     <varlistentry><term>list-installed | li</term>
     <listitem><para>
     Synonym to <literal/list alli/. Acts like
     <literal/list-available/ but limits the list to the installed
     source packages.
     </varlistentry>

     <varlistentry><term>search</term>
     <listitem><para>
     Synonym to <literal/list -s/. Looks for locally compiled packages
     first and (if none found) searches for alternative installation
     candidates with apt-cache.
     </varlistentry>

     <varlistentry><term>get</term>
     <listitem><para>
     <literal/get/ followed by the package list installs the package
     source, downloading source packages when needed.
     </varlistentry>

     <varlistentry><term>build</term>
     <listitem><para>
     <literal/build/ is followed by one or more source packages that
     should be built. It chooses the kernel source appropriate for the
     currently running kernel unless different directories have been
     specified. If the build fails, look for the most recent log file
     in /var/cache/modass (or the user-specified location).
     </varlistentry>

     <varlistentry><term>install</term>
     <listitem><para>
     <literal/install/ is followed by one or more packages desired for
     installation. The last built package for the current running
     kernel is chosen.
     </varlistentry>

     <varlistentry><term>auto-install | a-i</term>
     <listitem><para>
     <literal/auto-install/ is followed by one or more packages
     desired for installation. It will run prepare to configure your
     system to build packages, get the package source, try to build it
     for the current kernel and install it.  You can use
     <literal/alli/ or <literal/allu/ shortcuts to select all
     installed modules source packages or only those that have been
     unpacked before (similar to the <literal/make-kpkg/ tool normally
     does, looking in $MODULE_LOC)
     </varlistentry>

     <varlistentry><term>auto-build | a-b</term>
     <listitem><para>
     like <literal/auto-install/ but does not install the package
     immediately
     </varlistentry>

     <varlistentry><term>clean</term>
     <listitem><para>
     <literal/clean/ clears the build directories of the kernel
     packages.
     </varlistentry>

     <varlistentry><term>purge</term>
     <listitem><para>
     <literal/purge/ clears the information cache of a source package
     and removes all binary packages locally built from it (that
     module-assistant knows about). USE WITH CARE!
     </varlistentry>

   </variablelist>
 </refsect1>

 <refsect1><title>Options</title>
 <variablelist>

   <varlistentry><term><option/-t/</term><term><option/--text-mode/</term>
   <listitem><para>
   Show pure build/install/update logs, no progress bars.
   </varlistentry>

   <varlistentry><term><option/-k/</term><term><option/--kernel-dir/</term>
   <listitem><para>
   The kernel source directories to be used for builds. You can
   specify multiple directories with multiple options or separated by
   commas or line separators (e.g using
   <command>-k "`echo /usr/src/linux-headers-*`"</command>
   ).
   The kernel versions detected in this directories are automatically
   added to the list of target kernel versions
   (see <option>--kvers-list</option> for details).
   </varlistentry>

   <varlistentry><term><option/-l/</term><term><option/--kvers-list/</term>
   <listitem><para>
   List of kernel version strings (as in KVERS) to act on. If omitted,
   the version string of the currently running kernel is inserted. If
   <option>--kernel-dir</option> specifies additional source
   directories, the kernel versions that belong to them will be
   inserted too.
   <para>
   The locations of the kernel source (or headers) that belong to this
   kernel versions are either detected by a lookup in the "usual"
   locations on Linux systems, or they must be specified with the
   <option>--kernel-dir</option> option.
   </varlistentry>

   <varlistentry><term><option/-v/</term><term><option/--verbose/</term>
   <listitem><para>
   Shows a bit more information, like full paths of the binary
   packages.
   </varlistentry>

   <varlistentry><term><option/-n/</term><term><option/--no-rebuild/</term>
   <listitem><para>
   If a package that is to be generated does already exist in the
   target directory (maybe in on older version), <option/-n/ prevents
   from building the package again.
   <para>
   The default behaviour is to skip when exactly the same file (with
   the same filename) is to be generated as the one that already
   exists, and the new filename could be detected before starting the
   build process (depends on the module package).
   </varlistentry>

   <varlistentry><term><option/-f/</term><term><option/--force/</term>
   <listitem><para>
   Never look for target file (in another version) and force a build.
   For the get command, download a newer version of a package even if
   it is already installed.
   </varlistentry>

   <varlistentry><term><option/-u/</term><term><option/--userdir/</term>
   <listitem><para>
   All relevant environment variables with paths will be redirected to
   new directories under the one specified with this option.
   </varlistentry>

   <varlistentry><term><option/-i/</term><term><option/--non-inter/</term>
   <listitem><para>
   When the package build was not successful, just continue with other
   candidates. By default, module-assistant will suggest to examine
   the build log. This option may also modify the behaviour of dpkg
   and apt-get to reduce the need for human interaction and install
   build dependencies as needed.
   </varlistentry>

   <varlistentry><term><option/-o/</term><term><option/--unpack-once/</term>
   <listitem><para>
   Try to not unpack twice. The option needs to be also specified when
   the package is being unpacked for the first time.  Experimental
   option, don't rely on it.
   </para>
   </listitem>
   </varlistentry>

   <varlistentry><term><option/-O/</term><term><option/--not-unpack/</term>
   <listitem><para>
   Never unpack the source tarball. Useful after manual manipulation
   of module source.
   </para>
   </listitem>
   </varlistentry>

   <varlistentry><term><option/-q/</term><term><option/--quiet/</term>
   <listitem><para>
   Suppress some of the noisy messages during the processing.
   </varlistentry>

   <varlistentry><term><option/-S/</term><term><option/--sudo-cmd/</term>
   <listitem><para>
   A replacement command for superuser commands to be used instead of
   <literal/sudo/.
   </varlistentry>

   <varlistentry><term><option/-s/</term><term><option/--apt-search/</term>
   <listitem><para>
   See <literal/search/ command for details.
   </varlistentry>

   <varlistentry><term><option/-h/</term><term><option/--help/</term>
   <listitem><para>
   Prints the usage overview.
   </varlistentry>
 </variablelist>
 </refsect1>

 <refsect1><title>ENVIRONMENT VARIABLES</title>
   <para>
   You can export the following environment variables to modify the
   behaviour of the build scripts. Some packages may ignore them or
   interpret them differently.

   <variablelist>
     <varlistentry><term>KPKG_DEST_DIR</term>
     <listitem><para>
     <literal/KPKG_DEST_DIR/ specify the target directory where the
     resulting Debian package should be installed into. However, many
     packages ignore this variable and install the file into the
     directory above the kernel source directory or above the current
     directory.
     </varlistentry>

     <varlistentry><term>KERNELDIRS</term>
     <listitem><para>
     <literal/KERNELDIRS/ specifies or extends the list of kernel
     source/header directory which m-a should build modules for. See
     /-k/-Option for details.
     </varlistentry>

     <varlistentry><term>SIGNCHANGES</term>
     <listitem><para>
     If <literal/SIGNCHANGES/ is set, .changes files will be generated
     (calling <literal/kdist_image/ rule instead of kdist) and debsign
     (or gpg or pgp) will be executed to sign the changes.
     </varlistentry>

     <varlistentry><term>KMAINT | DEBFULLNAME | DEBNAME</term>
     <listitem><para>
     Specifies the realname of the person building the package
     (interesting for .changes file only)
     </varlistentry>

     <varlistentry><term>KEMAIL | DEBEMAIL</term>
     <listitem><para>
     Specifies the email address of the person building the package
     (interesting for .changes file only).
     </varlistentry>

     <varlistentry><term>MODULE_LOC</term>
     <listitem><para>
     A different location for the (already extracted) module source
     directories. Default is <filename>/usr/src/modules</filename>.
     </varlistentry>

     <varlistentry><term>MA_VARDIR</term>
     <listitem><para>
     A different location for cached data, used by helper scripts from
     <command/module-assistant/. Default
     is <filename>/var/cache/modass</filename>.
     </varlistentry>

     <varlistentry><term>MA_APTCMD</term>
        <listitem><para>
              Command to download install packages, to use instead of the
              <command>apt-get</command>.
     </varlistentry>

     <varlistentry><term>MOD_SRCDIR</term>
     <listitem><para>
     A different location for module source tarballs. Default is
     <filename>/usr/src</filename>.
     </varlistentry>

     <varlistentry><term>ROOT_CMD</term>
     <listitem><para>
     Wrapper command to execute command as root. If you are not root,
     fakeroot is chosen automatically. This variable must be
     interpreted by individual packages so some of them may ignore
     it. However, you can still run module-assistant inside of the
     ROOT_CMD wrapper.
     </varlistentry>
   </variablelist>
 </refsect1>

 <refsect1><title>Non-Root usage</title>
   <para>
   <command/module-assistant/ can work without being root. However you
   won't be able to use apt-get or dpkg to install the packages, and
   you cannot write to <filename>/var/cache/modass</filename> on a
   normal Debian system. So the commands
   are <command>get</command>, <command>install</command>,
   <command>auto-install</command> and <command>prepare</command> are taboo for
   regular users. However, if the sudo program is installed, it will be
   invoked for apt-get and dpkg operations.
   All remaining commands except of <command>list</command>
   require additional environment variables to move the target paths to
   locations writable for the user. They all can be trimmed to a
   certain location (a writable directory) using the -u switch.
</refsect1>

 <refsect1><title>Files</title>
   <variablelist>
     <varlistentry><term><filename>/usr/share/modass/packages/*</filename></term>
     <listitem><para>
     List of helper scripts shipped with the module-assistant package.
     </varlistentry>

     <varlistentry><term><filename>/usr/share/modass/overrides/*</filename></term>
     <listitem><para>
     Helper scripts installed by other packages.
     </varlistentry>
   </variablelist>
 </refsect1>

 <refsect1><title>See Also</title>
   <para>
   <citerefentry><refentrytitle><command/make-kpkg/</refentrytitle><manvolnum/1/</citerefentry>,
   <citerefentry><refentrytitle><filename>/usr/share/doc/module-assistant/README</filename></refentrytitle></citerefentry>
 </refsect1>

 <refsect1><title>Bugs</title>
   <para>
   See the <ulink url='http://bugs.debian.org/src:module-assistant'>module-assistant bug page</>.
   If you wish to report a bug in module-assistant, please use
   the
   <citerefentry>
     <refentrytitle><command/reportbug/</refentrytitle><manvolnum/1/
   </citerefentry>
   command.
 </refsect1>


 <refsect1><title>Return codes</title>
   <variablelist>
     <varlistentry><term>0</term>
     <listitem><para>
     Success
     </varlistentry>

     <varlistentry><term>1..249</term>
     <listitem><para>
     various errors during the build process
     </varlistentry>

     <varlistentry><term>254</term>
     <listitem><para>
     problem with permissions
     </varlistentry>

     <varlistentry><term>255</term>
     <listitem><para>
     fixable error after user intervention
     </varlistentry>
   </variablelist>
 </refsect1>

 <refsect1><title>TODO</title>
   <para>
   Quicklist (fast output without details)

   <para>
   Integration into APT and/or into the init system

   <para>
   "Aggressive" debianisation using the templates set (to generate a
   package with guessed name from any source that looks like being
   compatible with kernel 2.6 build system)

   <para>
   Automatic transformation of kernel sources to generate .udeb packages
 </refsect1>

 <refsect1><title>Author</title>
   <para>
   Module-Assistant was written by Eduard
   Bloch <email>blade@debian.org</email> for the Debian distribution.
 </refsect1>

</refentry>
