]>
Commit | Line | Data |
---|---|---|
a6f80f0e | 1 | python-ifupdown2 |
2 | ================ | |
3 | ||
4 | This package is a replacement for the debian ifupdown package. | |
2c0ad8b3 | 5 | It is ifupdown re-written in python. It maintains the original ifupdown |
a6f80f0e | 6 | pluggable architecture and extends it further. |
7 | ||
8 | The python-ifupdown2 package provides the infrastructure for | |
9 | parsing /etc/network/interfaces file, loading, scheduling and state | |
10 | management of interfaces. | |
11 | ||
12 | It dynamically loads python modules from /usr/share/ifupdownmodules (provided | |
13 | by the python-ifupdown2-addons package). To remain compatible with other | |
14 | packages that depend on ifupdown, it also executes scripts under /etc/network/. | |
15 | To make the transition smoother, a python module under | |
16 | /usr/share/ifupdownmodules will override a script by the same name under | |
17 | /etc/network/. | |
18 | ||
19 | It publishes an interface object which is passed to all loadble python | |
2c0ad8b3 RP |
20 | modules. For more details on adding a addon module, see the section on |
21 | adding python modules. | |
a6f80f0e | 22 | |
23 | ||
24 | pluggable python modules: | |
25 | ========================= | |
26 | Unlike original ifupdown, all interface configuration is moved to external | |
27 | python modules. That includes inet, inet6 and dhcp configurations. | |
28 | ||
2c0ad8b3 RP |
29 | A set of default modules are provided by the python-ifupdown2-addons deb. |
30 | ||
31 | python-ifupdown2 expects a few things from the pluggable modules: | |
a6f80f0e | 32 | - the module should implement a class by the same name |
33 | - the interface object (class iface) and the operation to be performed is | |
34 | passed to the modules | |
2c0ad8b3 | 35 | - the python addon class should provide a few methods: |
a6f80f0e | 36 | - run() : method to configure the interface. |
37 | - get_ops() : must return a list of operations it supports. | |
38 | eg: 'pre-up', 'post-down' | |
39 | - get_dependent_ifacenames() : must return a list of interfaces the | |
40 | interface is dependent on. This is used to build the dependency list | |
2c0ad8b3 RP |
41 | for sorting and executing interfaces in dependency order. |
42 | - if the module supports -r option to ifquery, ie ability to construct the | |
43 | ifaceobj from running state, it can optionally implement the | |
44 | get_dependent_ifacenames_running() method, to return the list of | |
45 | dependent interfaces derived from running state of the interface. | |
46 | This is different from get_dependent_ifacenames() where the dependent | |
47 | interfaces are derived from the interfaces config file (provided by the | |
48 | user). | |
4716e0e5 | 49 | |
2c0ad8b3 | 50 | Example: Address handling module /usr/share/ifupdownaddons/address.py |
4716e0e5 | 51 | |
4716e0e5 | 52 | |
2c0ad8b3 RP |
53 | build |
54 | ===== | |
55 | - get source | |
4716e0e5 | 56 | |
2c0ad8b3 RP |
57 | - install build dependencies: |
58 | apt-get install python-stdeb | |
59 | apt-get install python-docutils | |
4716e0e5 | 60 | |
2c0ad8b3 | 61 | - cd <python-ifupdown2 sourcedir> && ./build.sh |
4716e0e5 | 62 | |
2c0ad8b3 | 63 | (generates python-ifupdown2-<ver>.deb) |
739f665b | 64 | |
2c0ad8b3 RP |
65 | install |
66 | ======= | |
739f665b | 67 | |
2c0ad8b3 RP |
68 | - remove existing ifupdown package |
69 | dpkg -r ifupdown | |
70 | ||
71 | - install python-ifupdown2 using `dpkg -i` | |
72 | ||
73 | - or install from deb | |
74 | dpkg -i python-ifupdown2-<ver>.deb | |
739f665b | 75 | |
2c0ad8b3 RP |
76 | - note that python-ifupdown2 requires python-ifupdown2-addons package to |
77 | function. And python-ifupdown2-addons deb has an install dependency on | |
78 | python-ifupdown2 |