mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-01-14 18:52:08 +05:30
many changes -- see full commit message
The config file is now installed as /etc/naxalnet/naxalnet.conf.example by default. make uninstall now does not ask for confirmation. Added rule purge in Makefile. Updated the README. Changed order of stop commands in service file. Updated setup.cfg and docstrings.
This commit is contained in:
parent
274f08cded
commit
7e0fe5ef4c
7
Makefile
7
Makefile
@ -14,9 +14,14 @@ install: build
|
|||||||
$(PYTHON) setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
|
$(PYTHON) setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(PIP) uninstall naxalnet
|
$(PIP) uninstall -y naxalnet
|
||||||
rm -rf /usr/share/naxalnet /usr/lib/systemd/system/naxalnet.service
|
rm -rf /usr/share/naxalnet /usr/lib/systemd/system/naxalnet.service
|
||||||
|
@-test -d /etc/naxalnet && echo "The directory /etc/naxalnet was not removed." && \
|
||||||
|
echo "Do 'sudo make purge' to remove it."
|
||||||
|
|
||||||
|
# remove config files, like apt purge
|
||||||
|
purge:
|
||||||
|
rm -rf /etc/naxalnet
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build naxalnet.egg-info **/__pycache__
|
rm -rf build naxalnet.egg-info **/__pycache__
|
||||||
|
11
README.md
11
README.md
@ -202,16 +202,13 @@ sudo systemctl start NetworkManager.service
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
naxalnet stores its default configuration file in
|
naxalnet comes with a sample configuration file
|
||||||
`/usr/share/naxalnet/naxalnet.conf`. To change how the program
|
`/etc/naxalnet/naxalnet.conf.example`. To change how the program
|
||||||
behaves, copy it to /etc/naxalnet/naxalnet.conf and edit it:
|
behaves, copy it to /etc/naxalnet/naxalnet.conf and edit it:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create the directory
|
sudo cp /etc/naxalnet/naxalnet.conf{.example,}
|
||||||
sudo mkdir /etc/naxalnet
|
# Now edit the file with your favourite editor as root
|
||||||
# Now copy the file
|
|
||||||
sudo cp /usr/share/naxalnet/naxalnet.conf /etc/naxalnet
|
|
||||||
# Edit the file with your favourite editor as root
|
|
||||||
gedit admin:/etc/naxalnet/naxalnet.conf
|
gedit admin:/etc/naxalnet/naxalnet.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# This configuration file is part of naxalnet.
|
# This configuration file is part of naxalnet.
|
||||||
# To configure this program, copy this file
|
# To configure this program, rename this file
|
||||||
# to /etc/naxalnet/ (create it if it doesn't exist) and
|
# to naxalnet.conf and edit it.
|
||||||
# edit it to your liking.
|
# The values given here are defaults.
|
||||||
|
|
||||||
[networkd]
|
[networkd]
|
||||||
# systemd-networkd configuration files bundled with naxalnet.
|
# systemd-networkd configuration files bundled with naxalnet.
|
@ -29,9 +29,10 @@ ExecStart=/usr/bin/naxalnet
|
|||||||
ExecStartPost=/usr/bin/networkctl reload
|
ExecStartPost=/usr/bin/networkctl reload
|
||||||
# Delete all files in /run/systemd/network
|
# Delete all files in /run/systemd/network
|
||||||
ExecStop=/usr/bin/find /run/systemd/network -type f -delete
|
ExecStop=/usr/bin/find /run/systemd/network -type f -delete
|
||||||
ExecStopPost=/usr/bin/networkctl reload
|
# Delete the interfaces created...
|
||||||
# Delete the interfaces created
|
|
||||||
ExecStopPost=/usr/bin/networkctl delete bridge0 bat0
|
ExecStopPost=/usr/bin/networkctl delete bridge0 bat0
|
||||||
|
# ... and reload the configuration files.
|
||||||
|
ExecStopPost=/usr/bin/networkctl reload
|
||||||
# Make python flush messages instead of buffering.
|
# Make python flush messages instead of buffering.
|
||||||
# When reading the systemd journal, we need to see the messages
|
# When reading the systemd journal, we need to see the messages
|
||||||
# in the exact order. There will suddenly be a lot of messages
|
# in the exact order. There will suddenly be a lot of messages
|
||||||
|
@ -34,6 +34,6 @@ See README.md for documentation.
|
|||||||
# example: 0.2.0a3.dev1 should mean 1 commit in the new
|
# example: 0.2.0a3.dev1 should mean 1 commit in the new
|
||||||
# branch after the commit in master.
|
# branch after the commit in master.
|
||||||
#
|
#
|
||||||
# In case you forgot to add a version, put the next number
|
# In case you forgot to change the version, skip the number
|
||||||
# in the next commit
|
# and put the next number in the next commit.
|
||||||
__version__ = "0.2.0a3.dev4"
|
__version__ = "0.2.0a3.dev6"
|
||||||
|
@ -18,10 +18,13 @@ following order:
|
|||||||
- First it reads /usr/share/naxalnet/naxalnet.conf
|
- First it reads /usr/share/naxalnet/naxalnet.conf
|
||||||
and then from /usr/share/naxalnet/naxalnet.conf.d/*.conf
|
and then from /usr/share/naxalnet/naxalnet.conf.d/*.conf
|
||||||
where *.conf means any file with the name ending with
|
where *.conf means any file with the name ending with
|
||||||
.conf
|
".conf". The files in this directory are intended
|
||||||
|
to be used by distribution and package maintainers.
|
||||||
|
- Next, it does the same with /usr/local/share/naxalnet
|
||||||
- Then, it looks for the files naxalnet.conf and
|
- Then, it looks for the files naxalnet.conf and
|
||||||
naxalnet.conf.d/*.conf from the directory
|
naxalnet.conf.d/*.conf from the directory
|
||||||
/etc/naxalnet, like it did up above.
|
/etc/naxalnet, like it did up above. This directory is where
|
||||||
|
the user creates and stores the config file.
|
||||||
- Then it parses the arguments from the commandline,
|
- Then it parses the arguments from the commandline,
|
||||||
storing the values in the files parsed until now
|
storing the values in the files parsed until now
|
||||||
as fallback. Finally you get an argpase.Namespace object
|
as fallback. Finally you get an argpase.Namespace object
|
||||||
@ -30,7 +33,7 @@ following order:
|
|||||||
pairs in the configuration should have an argument
|
pairs in the configuration should have an argument
|
||||||
too, or they won't be parsed.
|
too, or they won't be parsed.
|
||||||
|
|
||||||
All the key-value pairs are replaced if they exist
|
All the key-value pairs are replaced successively if they exist
|
||||||
by each new configuration file parsed, similar
|
by each new configuration file parsed, similar
|
||||||
to how systemd parses configuration and service files.
|
to how systemd parses configuration and service files.
|
||||||
If any of the files checked does not exist, then they are
|
If any of the files checked does not exist, then they are
|
||||||
|
@ -23,4 +23,4 @@ CONFIG = {
|
|||||||
|
|
||||||
# glob
|
# glob
|
||||||
CONFIG_FILES = ["naxalnet.conf", "naxalnet.conf.d/*.conf"]
|
CONFIG_FILES = ["naxalnet.conf", "naxalnet.conf.d/*.conf"]
|
||||||
CONFIG_DIRS = ["/usr/share/naxalnet", "/etc/naxalnet"]
|
CONFIG_DIRS = ["/usr/share/naxalnet", "/usr/local/share/naxalnet", "/etc/naxalnet"]
|
||||||
|
@ -29,8 +29,8 @@ console_scripts =
|
|||||||
[options.data_files]
|
[options.data_files]
|
||||||
/usr/lib/systemd/system =
|
/usr/lib/systemd/system =
|
||||||
naxalnet.service
|
naxalnet.service
|
||||||
/usr/share/naxalnet =
|
/etc/naxalnet =
|
||||||
naxalnet.conf
|
naxalnet.conf.example
|
||||||
/usr/share/naxalnet/networkd =
|
/usr/share/naxalnet/networkd =
|
||||||
systemd-networkd/01-batman.netdev
|
systemd-networkd/01-batman.netdev
|
||||||
systemd-networkd/02-bridge.netdev
|
systemd-networkd/02-bridge.netdev
|
||||||
|
Loading…
x
Reference in New Issue
Block a user