Skip to content

Commit

Permalink
Update documentation to install with make
Browse files Browse the repository at this point in the history
  • Loading branch information
juga0 committed Sep 10, 2017
1 parent 634317c commit 8068a9e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 88 deletions.
101 changes: 67 additions & 34 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,92 @@
Install dhcpcanon
=================

The recommended way to install ``dhcpcanon`` is with the Debian package manager,
as it will also install the ``systemd`` service.
The recommended way to install ``dhcpcanon`` is with your package source
distribution, as it will also install other system files.

The installation from source is recommended for developers or other Linux
distributions.

Installation in Debian testing
-------------------------------
::
Currently is availabe for Debian unstable/testing.
It can be installed with a package manager or in command line::

sudo apt install dhcpcanon

Installation in Debian/Ubuntu from source code
----------------------------------------------
The main script will be installed in ``/sbin/dhcpcanon``, a systemd service
will be enabled and run by default, so there is no need to run anything manually.

Installation from source code
==============================

Install system dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~
In case you would like to have a newer version or it is not packaged for your
distribution, you can install it from the source code.

::
Install system dependencies, in Debian/Ubuntu::

sudo apt install python-dev

Install dhcpcanon dependencies with virtualenv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Obtain the source code::

git clone https://github.com/juga0/dhcpcanon/

Install ``dhcpcanon`` and system files::

sudo make install WITH_SYSTEMD=true

In Debian this will install all the required files under ``/usr/local``.
``WITH_SYSTEMD`` will install a systemd service and enable it, to run it::

systemctl start dhcpcanon

for advanced users
--------------------

In the case that you would like to install without root privileges,
you can install it without the systemd service and you can specify
an alternative location, for instance::

make --prefix=/home/user/.local install

Note however that without systemd ``dhcpcanon`` will need to be run with root
privileges, while the systemd service drop ``dhcpcanon`` root privileges and
only keeps the required network capabilities.

An alternative to do not run ``dhcpcanon`` with root privileges nor systemd,
is to use `ambient-rs wrapper <https://github.com/infinity0/ambient-rs>`
and run::

Obtain virtualenv
^^^^^^^^^^^^^^^^^
RUST_BACKTRACE=1 ./target/debug/ambient -c NET_RAW,NET_ADMIN,NET_BIND_SERVICE /usr/bin/python3 -m dhcpcanon.dhcpcanon -v

Check https://virtualenv.pypa.io/en/latest/installation.html or
if Debian equal/newer than Jessie (virtualenv version equal or greater
than 1.9), then::
Installation with pip
==========================

The pip package does not install either system files and it can be installed
without root, but it still needs to be run as root, as commented in the last
section.::

pip install dhcpcanon

In Debian this will install the files in ``/home/youruser/.local``
Note also that if you install it in a virtualenv, when executing ``dhcpcanon``
with ``sudo``, won't use the virtualenv. To keep the virtualenv run it with::

sudo /pathtovirtualenv/bin/dhcpcanon

Installation for developers
=============================

It is recommended to install ``dhcpcanon`` in a python virtual environment.

Check https://virtualenv.pypa.io/en/latest/installation.html. In Debian::

sudo apt install python-virtualenv

Create a virtual environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
Create a virtual environment::

mkdir ~/.virtualenvs
virtualenv ~/.virtualenvs/dhcpcanonenv
source ~/.virtualenvs/dhcpcanonenv/bin/activate

Install dependencies in virtualenv
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Get the sources::
git clone https://github.com/juga0/dhcpcanon
cd dhcpcanon
pip install -r requirements.txt

or run::
Install it::

python setup.py install

or run::

pip install dhcpcanon
pip install -e .
63 changes: 9 additions & 54 deletions docs/source/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,23 @@
Running dhcpcanon
==================

If ``dhcpcanon`` is installed in the system (with the Debian package,
sudo pip install dhcpcanon or sudo python setup.py), run it just invoking::
If ``dhcpcanon`` has be installed with systemd, it can be started with::

dhcpcanon
sudo systemctl start dhcpcanon

If it's not installed, but a virtualenv has been created,
it can still be run in a virtualenv with:
After installing, it can also be run manually::

source ~/.virtualenv/dhcpcanon/bin/activate
pip install -e .
sudo scripts/dhcpcanon
sudo dhcpcanon

There is no need to pass any argument, most of the arguments are only used when
``dhcpcanon`` is called by other program (``systemd`` or
``gnome network manager``) and mimic the ``dhclient`` arguments.

An useful argument when reporting bugs is ``-v``.

In that case it will use the active interface.
If there're several active interfaces the behaviour right now
is not predictable.

An updated command line usage description can be always obtained with::
scripts/dhcpcanon -h
You can specify which network interface to use passing it as an argument.
Without specificying the network interface, it will use the active interface.

At the time of writing this the usage documentation is::

usage: dhcpcanon [-h] [-v] [-l LEASE] [--version] [-sf [script-file]]
[-pf [pid-file]] [-lf [lease-file]] [-cf [config-file]] [-d]
[-q] [-N] [-6] [-4]
[interface]
An useful argument when reporting bugs is ``-v``.

positional arguments:
interface interface to configure with DHCP
An updated command line usage description can be obtained with::

optional arguments:
-h, --help show this help message and exit
-v, --verbose Set logging level to debug
-l LEASE, --lease LEASE
custom lease time
--version version
-sf [script-file] Path to the network configuration script invoked by
dhclient when it gets a lease. If unspecified, the
default /sbin/dhcpcanon-script is used. See dhclient-
script(8) for a description of this file.
-pf [pid-file] Path to the process ID file. If unspecified,
thedefault /var/run/dhclient.pid is used
-lf [lease-file] Path to the lease database file. If unspecified,
thedefault /var/lib/dhcp/dhclient.leases is used. See
dhclient.leases(5) for a description of this file.
-cf [config-file] Path to the client configuration file. If
unspecified,the default /etc/dhcp/dhclient.conf is
used. See dhclient.conf(5) for a description of this
file.
-d Force dhclient to run as a foreground process.
Normally the DHCP client will run in the foreground
until is has configured an interface at which time it
will revert to running in the background. This option
is useful when running the client under a debugger, or
when running it out of inittab on System V systems.
This implies -v.
-q Be quiet at startup, this is the default.
-N
-6
-4
dhcpcanon -h

0 comments on commit 8068a9e

Please sign in to comment.