<?xml version="1.0" encoding="UTF-8"?>
<doc>
	<back to="packages"/>
	<title>eselect paludis-hooks</title>
	<section>
	
		<description>
			<para>
				This is an extension to eselect to added support for paludis hooks in eselect, for easy enabling and disabling.
			</para>
		</description>
		<author>zxy</author>
		<dependencies>
			<item>
				<para>
					app-admin/eselect
				</para>
			</item>
		</dependencies>
		<title>Installation</title>
		<section>
			<title>without paludis-hooks installed</title>
			<subsection>
				Just install the package.
				<code>paludis -i app-admin/eselect-paludis-hooks</code>
			</subsection>
			<title>if you have paludis-hooks installed</title>
			<subsection>
			<para>
 				Enable the <strong>eselect</strong> extended use flag in the <file>/etc/paludis/use.conf</file> file, by adding <strong>eselect</strong> to the line.<code>* PALUDIS_HOOKS: eselect .......</code>
			</para>
			<para>
				Then run:
				<code>paludis -i paludis-hooks --dl-reinstall if-use-changed</code>
			</para>
			</subsection>
		</section>
		<title>Usage</title>
		<section>
			<para>
				To get a list of usage options run
				<code>eselect paludis-hook</code>
				which will show output like this
				<code title="Usage information">
Usage: eselect paludis-hook <closed>action</closed> <closed>options</closed>

Standard actions:
  help                      Display help text
  usage                     Display usage information
  version                   Display version information

Extra actions:
  check <closed>target</closed>          Check a hook's symlinks
    target                    A hookname (from 'list' action) or 'all', to 
                              check all hooks 
  disable <closed>target</closed>        Disable a hook - remove symlinks
    target                    A hookname (from 'list' action) or 'all', to 
                              disable all hooks 
  enable <closed>target</closed>         Enable a hook
    target                    A hookname (from 'list' action) or 'all', to 
                              enable all hooks 
  list                      List hooks managable by eselect
				</code>
			</para>
			<para>
				To get a list of hooks that is installed, you can run the command below, which also shows the state of the hooks.
				<code title="List installed hooks and state">eselect paludis-hook list</code>
			</para>
			<para>
				To enable/disable a hook you can run a command like the one below.
				<code title="Enable the update-eix hook">eselect paludis-hook enable update-eix</code>
				Or
				<code title="Disable the update-eix hook">eselect paludis-hook disable update-eix</code>
			</para>
			<para>
				You can use the <strong>check</strong> command to see at witch points the hook script is being run, and if all of the symlinks are there, like this
				<code title="Example 1 where we check update-eix">
# eselect paludis-hook check update-eix
checking update-eix ...
  update-eix.bash  should be linked to: 
                            
    sync_all_pre/ ...  OK
    sync_all_post/ ...  OK</code>
    				<code title="Example 2 where we check update-eix">
# eselect paludis-hook check update-eix
    checking update-eix ...
    update-eix.bash  is not enabled.
    
    Checking stale links:
    sync_all_pre/ ...  no symlink ... OK
    sync_all_post/ ...  no symlink ... OK</code>
			</para>
		</section>
		<section>
			<title>Where is all this happening</title>
			<para>
				The hooks managed via <strong>eselect paludis-hook</strong> are placed in the <file>/usr/share/paludis/hooks/common/</file> folder.
			</para>
			<para>
				<strong>eselect paludis-hook</strong> has a definition of which hook scripts need to be linked to which hook folder. These definition files are located in <file>/usr/share/paludis/hooks/eselect/</file> which is of the following format
				<code title="Definition file format">
path_to_script/hook-script hook_dir_1 hook_dir_2 ...</code>
				where <file>path_to_script/hook-script</file> defines the path to a script under <file>/usr/share/paludis/hooks/</file> and the <strong>hook_dir_n</strong> is the hook folder where to symlink it in.
				<code title="Definition example for update-eix">
# eselect definition file for paludis-hooks-update-eix-2.1.1
common/update-eix.bash  sync_all_pre sync_all_post</code>
				The file can have more than one line. So this way it it also possible to have something like a set of hooks defined.
			</para>
		</section>
		<sources title="scripts">
			<item href="files/paludis-hook.eselect">paludis-hook.eslect script</item>
		</sources>
	
	</section>
</doc>
