add --show-config option, update README
This commit is contained in:
parent
deae9af4c6
commit
ebaa847abd
90
README.md
90
README.md
@ -3,9 +3,9 @@
|
|||||||
A message board for packet radio, suitable for use with ax25d.
|
A message board for packet radio, suitable for use with ax25d.
|
||||||
|
|
||||||
Really Simple BBS (`rsbbs`) implements a bulletin board system that enables
|
Really Simple BBS (`rsbbs`) implements a bulletin board system that enables
|
||||||
radio amateurs to read and store messages at your station. It is similar to the
|
radio amateurs to read and store messages at your station. It generally adopts
|
||||||
PBBS function of popular Kantronics TNCs, and it uses similar commands (`B`,
|
conventions common to other popular BBS systems, (`B`, `J`, `K`, `L`, `R`, `S`,
|
||||||
`J`, `K`, `L`, `R`, `S`, `H`, etc.).
|
`H`, etc.)
|
||||||
|
|
||||||
It is designed to run on a linux system when called by `ax25d`. That is, when a
|
It is designed to run on a linux system when called by `ax25d`. That is, when a
|
||||||
user calls your station, `ax25d` answers the call and routes the connection to
|
user calls your station, `ax25d` answers the call and routes the connection to
|
||||||
@ -14,32 +14,55 @@ user calls your station, `ax25d` answers the call and routes the connection to
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
In general, you need a linux system with ax25d configured and working. This is
|
- **AX.25:** It is assumed that you have a radio connected to your host, that
|
||||||
a python 3 application, so you will need python 3 also.
|
you have configured your axports, and that ax25d can answer calls.
|
||||||
|
- **Python 3:** As this is a python 3 application, you will need python 3 and
|
||||||
|
pip.
|
||||||
|
- **Hardware:** A system capable of running Direwolf and ax25d should be more
|
||||||
|
than sufficient.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Until I publish this thing to PyPI, you can clone it and build it yourself:
|
Clone this repository and install it with pip:
|
||||||
|
|
||||||
1. Clone the repo to a reasonable location.
|
```
|
||||||
2. `cd` to the repo directory
|
git clone https://git.b-wells.us/jmbwell/rsbbs.git
|
||||||
3. Run `python3 -m pip build .`
|
cd rsbbs
|
||||||
4. Run `python3 -m pip install .`
|
python3 -m virtualenv .venv
|
||||||
5. Run `rsbbs -h` to test installation and create config and data files.
|
source .venv/bin/activate
|
||||||
|
pip install .
|
||||||
|
rsbbs -h
|
||||||
|
```
|
||||||
|
|
||||||
|
The config file will be created at first launch.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
By default, the `config.yaml` file lives in your system's user config
|
By default, the `config.yaml` file lives in your system's user config
|
||||||
directory, such as `~/.config/rsbbs/config.yaml`.
|
directory, such as `~/.config/rsbbs/config.yaml`, as determined by the
|
||||||
|
`platformdirs` module.
|
||||||
|
|
||||||
To use a `config.yaml` file from a different location, use the `-f` option:
|
To use a `config.yaml` file from a different location, use the `-f` option:
|
||||||
```
|
```
|
||||||
rsbbs -f ~/config.yaml -s KI5QKX
|
rsbbs -f ~/config.yaml -s <calling station's callsign>
|
||||||
```
|
```
|
||||||
|
|
||||||
If this file is missing, `rsbbs` will create it.
|
Either way, if the file is missing, `rsbbs` will create it.
|
||||||
|
|
||||||
The `config.yaml` file is pretty simple and self-explanatory for now.
|
The `config.yaml` file is pretty simple and self-explanatory for now:
|
||||||
|
```
|
||||||
|
bbs_name: John's Really Simple BBS
|
||||||
|
callsign: HOSTCALL
|
||||||
|
banner_message: Leave a message!
|
||||||
|
command_prompt: ENTER COMMAND >
|
||||||
|
```
|
||||||
|
|
||||||
|
> Tip:
|
||||||
|
> To show the location of the current config file (among other configuration
|
||||||
|
> options), run:
|
||||||
|
> ```
|
||||||
|
> rsbbs --show-config
|
||||||
|
> ```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -53,17 +76,25 @@ following to your `ax25d.conf` file:
|
|||||||
default * * * * * * * root /usr/local/bin/rsbbs rsbbs -s %U
|
default * * * * * * * root /usr/local/bin/rsbbs rsbbs -s %U
|
||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
> Notes:
|
||||||
- The installation path may vary on your system.
|
> - Specify the full path to the `rsbbs` application.
|
||||||
- Be sure to specify the `-s %U` parameters; this passes the ax.25 caller's
|
> - The installation path may vary on your system.
|
||||||
callsign to the `rsbbs` application.
|
> - If you install it in a virtualenv, specify the path to `rsbbs` in that
|
||||||
|
> virtualenv's `/bin` directory.
|
||||||
|
> - Be sure to specify the `-s %U` parameter; this passes the ax.25 caller's
|
||||||
|
> callsign to the `rsbbs` application.
|
||||||
|
|
||||||
See the ax25d man page for more details.
|
|
||||||
|
See `man ax25d.conf` for more details.
|
||||||
|
|
||||||
### Directly
|
### Directly
|
||||||
|
|
||||||
You can also run it directly, for administration purposes or just to talk to
|
You can launch it from the command line on your packet station's host, and you
|
||||||
yourself. It will not accept calls when run without ax25d.
|
can interact with it just as you would over the air.
|
||||||
|
|
||||||
|
This might be useful for administration purposes or just to talk to yourself.
|
||||||
|
It does not have a standalone mode for taking calls, however -- that's what
|
||||||
|
ax25d is for.
|
||||||
|
|
||||||
```
|
```
|
||||||
rsbbs -s URCALL
|
rsbbs -s URCALL
|
||||||
@ -71,7 +102,7 @@ rsbbs -s URCALL
|
|||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
Run `sbbs -h` to see the following help:
|
Run `rsbbs -h` to see the following help:
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: rsbbs [-h] [-d] -s CALLING_STATION [-f CONFIG_FILE] [-v]
|
usage: rsbbs [-h] [-d] -s CALLING_STATION [-f CONFIG_FILE] [-v]
|
||||||
@ -83,6 +114,7 @@ options:
|
|||||||
The callsign of the calling station
|
The callsign of the calling station
|
||||||
-f CONFIG_FILE, --config-file CONFIG_FILE
|
-f CONFIG_FILE, --config-file CONFIG_FILE
|
||||||
specify path to config.yaml file
|
specify path to config.yaml file
|
||||||
|
--show-config show the current configuration and exit
|
||||||
-v, --version show program's version number and exit
|
-v, --version show program's version number and exit
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -99,8 +131,20 @@ In general, on a macOS or linux system:
|
|||||||
3. Create a venv
|
3. Create a venv
|
||||||
4. Install it in "editable" mode with `pip install -e .`
|
4. Install it in "editable" mode with `pip install -e .`
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```
|
||||||
|
git clone https://git.b-wells.us/jmbwell/rsbbs.git
|
||||||
|
cd rsbbs
|
||||||
|
python3 -m virtualenv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
pip install -e .
|
||||||
|
rsbbs -h
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
Pull requests welcome. If you're not sure where to start:
|
||||||
|
|
||||||
1. Fork it (<https://git.b-wells.us/jmbwell/rsbbs>)
|
1. Fork it (<https://git.b-wells.us/jmbwell/rsbbs>)
|
||||||
2. Create your feature branch (`git checkout -b feature/fooBar`)
|
2. Create your feature branch (`git checkout -b feature/fooBar`)
|
||||||
3. Commit your changes (`git commit -am 'add some fooBar'`)
|
3. Commit your changes (`git commit -am 'add some fooBar'`)
|
||||||
|
|||||||
@ -48,6 +48,13 @@ class Config():
|
|||||||
def __getattr__(self, __name: str):
|
def __getattr__(self, __name: str):
|
||||||
return self.config[__name]
|
return self.config[__name]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
repr = []
|
||||||
|
repr.append(f"app_name: {self.app_name}\r\n")
|
||||||
|
repr.append(f"config_file: {self.config_file}\r\n")
|
||||||
|
repr.append(yaml.dump(self.config))
|
||||||
|
return ''.join(repr)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config_file(self):
|
def config_file(self):
|
||||||
# Use either the specified file or a file in a system config location
|
# Use either the specified file or a file in a system config location
|
||||||
|
|||||||
@ -74,6 +74,9 @@ class Console():
|
|||||||
"""Write something to stdout."""
|
"""Write something to stdout."""
|
||||||
sys.stdout.write(output + '\r\n')
|
sys.stdout.write(output + '\r\n')
|
||||||
|
|
||||||
|
def print_configuration(self):
|
||||||
|
self._write_output(repr(self.config))
|
||||||
|
|
||||||
def print_greeting(self):
|
def print_greeting(self):
|
||||||
# Show greeting
|
# Show greeting
|
||||||
greeting = []
|
greeting = []
|
||||||
@ -258,6 +261,11 @@ class Console():
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
# If asked to show the config, show the config;
|
||||||
|
if self.config.args.show_config:
|
||||||
|
self.print_configuration()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
# Show greeting
|
# Show greeting
|
||||||
self.print_greeting()
|
self.print_greeting()
|
||||||
|
|
||||||
|
|||||||
@ -39,8 +39,8 @@ def main():
|
|||||||
# [ short, long, action, default, dest, help, required ]
|
# [ short, long, action, default, dest, help, required ]
|
||||||
['-d', '--debug', 'store_true', None, 'debug',
|
['-d', '--debug', 'store_true', None, 'debug',
|
||||||
'Enable debugging output to stdout', False],
|
'Enable debugging output to stdout', False],
|
||||||
['-s', '--calling-station', 'store', 'N0CALL', 'calling_station',
|
# ['-s', '--calling-station', 'store', 'N0CALL', 'calling_station',
|
||||||
'Callsign of the calling station', True],
|
# 'Callsign of the calling station', True],
|
||||||
['-f', '--config-file', 'store', None, 'config_file',
|
['-f', '--config-file', 'store', None, 'config_file',
|
||||||
'Path to config.yaml file', False],
|
'Path to config.yaml file', False],
|
||||||
]
|
]
|
||||||
@ -48,6 +48,25 @@ def main():
|
|||||||
argv_parser.add_argument(
|
argv_parser.add_argument(
|
||||||
arg[0], arg[1], action=arg[2], default=arg[3], dest=arg[4],
|
arg[0], arg[1], action=arg[2], default=arg[3], dest=arg[4],
|
||||||
help=arg[5], required=arg[6])
|
help=arg[5], required=arg[6])
|
||||||
|
|
||||||
|
group = argv_parser.add_mutually_exclusive_group(required=True)
|
||||||
|
|
||||||
|
# Show config option:
|
||||||
|
group.add_argument(
|
||||||
|
'--show-config',
|
||||||
|
action='store_true',
|
||||||
|
default=None,
|
||||||
|
dest='show_config',
|
||||||
|
help="Show the configuration and exit")
|
||||||
|
|
||||||
|
# Calling station:
|
||||||
|
group.add_argument(
|
||||||
|
'-s',
|
||||||
|
'--calling-station',
|
||||||
|
action='store',
|
||||||
|
default='N0CALL',
|
||||||
|
dest='calling_station',
|
||||||
|
help="Callsign of the calling station")
|
||||||
|
|
||||||
# Version arg is special:
|
# Version arg is special:
|
||||||
argv_parser.add_argument(
|
argv_parser.add_argument(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user