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:
Pranav Jerry 2021-08-18 17:33:46 +05:30
parent 274f08cded
commit 7e0fe5ef4c
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B
8 changed files with 28 additions and 22 deletions

View File

@ -14,9 +14,14 @@ install: build
$(PYTHON) setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
uninstall:
$(PIP) uninstall naxalnet
$(PIP) uninstall -y naxalnet
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:
rm -rf build naxalnet.egg-info **/__pycache__

View File

@ -202,16 +202,13 @@ sudo systemctl start NetworkManager.service
### Configuration
naxalnet stores its default configuration file in
`/usr/share/naxalnet/naxalnet.conf`. To change how the program
naxalnet comes with a sample configuration file
`/etc/naxalnet/naxalnet.conf.example`. To change how the program
behaves, copy it to /etc/naxalnet/naxalnet.conf and edit it:
```sh
# Create the directory
sudo mkdir /etc/naxalnet
# Now copy the file
sudo cp /usr/share/naxalnet/naxalnet.conf /etc/naxalnet
# Edit the file with your favourite editor as root
sudo cp /etc/naxalnet/naxalnet.conf{.example,}
# Now edit the file with your favourite editor as root
gedit admin:/etc/naxalnet/naxalnet.conf
```

View File

@ -1,7 +1,7 @@
# This configuration file is part of naxalnet.
# To configure this program, copy this file
# to /etc/naxalnet/ (create it if it doesn't exist) and
# edit it to your liking.
# To configure this program, rename this file
# to naxalnet.conf and edit it.
# The values given here are defaults.
[networkd]
# systemd-networkd configuration files bundled with naxalnet.

View File

@ -29,9 +29,10 @@ ExecStart=/usr/bin/naxalnet
ExecStartPost=/usr/bin/networkctl reload
# Delete all files in /run/systemd/network
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
# ... and reload the configuration files.
ExecStopPost=/usr/bin/networkctl reload
# Make python flush messages instead of buffering.
# When reading the systemd journal, we need to see the messages
# in the exact order. There will suddenly be a lot of messages

View File

@ -34,6 +34,6 @@ See README.md for documentation.
# example: 0.2.0a3.dev1 should mean 1 commit in the new
# branch after the commit in master.
#
# In case you forgot to add a version, put the next number
# in the next commit
__version__ = "0.2.0a3.dev4"
# In case you forgot to change the version, skip the number
# and put the next number in the next commit.
__version__ = "0.2.0a3.dev6"

View File

@ -18,10 +18,13 @@ following order:
- First it reads /usr/share/naxalnet/naxalnet.conf
and then from /usr/share/naxalnet/naxalnet.conf.d/*.conf
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
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,
storing the values in the files parsed until now
as fallback. Finally you get an argpase.Namespace object
@ -30,7 +33,7 @@ following order:
pairs in the configuration should have an argument
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
to how systemd parses configuration and service files.
If any of the files checked does not exist, then they are

View File

@ -23,4 +23,4 @@ CONFIG = {
# glob
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"]

View File

@ -29,8 +29,8 @@ console_scripts =
[options.data_files]
/usr/lib/systemd/system =
naxalnet.service
/usr/share/naxalnet =
naxalnet.conf
/etc/naxalnet =
naxalnet.conf.example
/usr/share/naxalnet/networkd =
systemd-networkd/01-batman.netdev
systemd-networkd/02-bridge.netdev