added implementation of --print-wifi

And added it to the README.
Cleaned up the docstring in naxalnet/__main__.py
This commit is contained in:
Pranav Jerry 2021-08-13 12:30:30 +05:30
parent b50d0e3656
commit fe146b7a0d
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B
4 changed files with 21 additions and 5 deletions

View File

@ -122,6 +122,7 @@ wifi ap (also called wifi hotspot) on one of them.
Connect two wifi adapters on a device and [start naxalnet][startnx]. Connect two wifi adapters on a device and [start naxalnet][startnx].
Now an ap will be created on one of the adapters. Now an ap will be created on one of the adapters.
Type `naxalnet --print-wifi` to get the WiFi SSID and password.
If you had set up internet access on one of the peers, internet If you had set up internet access on one of the peers, internet
can be accessed from the AP. can be accessed from the AP.

View File

@ -15,6 +15,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
naxalnet
========
Create mesh networks with batman-adv, systemd-networkd and iwd.
See README.md for documentation.
"""
# GUIDE FOR CHANGING __version__ # GUIDE FOR CHANGING __version__
# #
@ -29,4 +36,4 @@
# #
# In case you forgot to add a version, put the next number # In case you forgot to add a version, put the next number
# in the next commit # in the next commit
__version__ = "0.2.0a3.dev1" __version__ = "0.2.0a3.dev2"

View File

@ -16,11 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
naxalnet
========
If called as python -m naxalnet, this file makes naxalnet run like If called as python -m naxalnet, this file makes naxalnet run like
it was called from the commandline. it was called from the commandline. Try:
python -m naxalnet --help
""" """
from naxalnet.scripts import here_be_dragons from naxalnet.scripts import here_be_dragons

View File

@ -105,6 +105,12 @@ def setup_devices(args):
ap_device.start_ap(args.ap_ssid, args.ap_passwd) ap_device.start_ap(args.ap_ssid, args.ap_passwd)
def print_wifi(args):
print("Mesh name:", args.adhoc_name)
print("SSID:", args.ap_ssid)
print("Password:", args.ap_passwd)
def here_be_dragons(): def here_be_dragons():
""" """
This function is run every time you This function is run every time you
@ -112,6 +118,10 @@ def here_be_dragons():
""" """
args = parse_args() args = parse_args()
if args.print_wifi:
print_wifi(args)
sys.exit(0)
try: try:
copy_files(args) copy_files(args)
except PermissionError as error: except PermissionError as error: