Skip to content

Commit

Permalink
DW_EXTRA_CONFIGS: allow adding the same parameter multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed Nov 18, 2023
1 parent 0bc2888 commit 3d78b12
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,21 @@ The `DW_EXTRA_CONFIGS` parameter can be used to add or change additional paramet
...
environment:
DW_EXTRA_CONFIGS=
PARAM1=value string "here";
PARAM2=;
PARAM1 value string "here";
PARAM2 "";
PARAM3;
PARAM4=remove
PARAM4=remove;
add:PARAM5 value string here
...
```

In this case:

- `PARAM1` is uncommented (if needed) and set with `value string "here"` (replacing any existing values if they exist)
- `PARAM2` is uncommented (if needed) and set with no value string (any existing values are removed)
- `PARAM1` is uncommented (if needed) and replaced with `value string "here"` (replacing any existing values if they exist)
- `PARAM2` is uncommented (if needed) and replaced with no value string (any existing values are removed)
- `PARAM3` is uncommented (if needed) and leaving any existing value string in place
- `PARAM4` is commented out
- `PARAM5` is added to the document regardless of the existence of the parameter. You can use this to add the same parameter multiple times

## Tuning the audio interface

Expand Down
6 changes: 4 additions & 2 deletions rootfs/etc/s6-overlay/scripts/30-set-direwolf-params
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function setdwconfig() {
# function to set direwolf config item
# usage: setdwconfig PARAM VALUE STRING
# If VALUE STRING is not present, it will simply uncomment PARAM if it exists, or add it (without values) to the end of the config file
# If VALUE STRING is specified as "VALUE" "STRING", "VALUE STRING", or "", it will uncomment and set value to PARAM VALUE STRING, or add PARAM VALUE STRING to the end of the config file
# If VALUE STRING is specified as "VALUE" "STRING", "VALUE STRING", or "", it will uncomment and set value to PARAM VALUE STRING, or add PARAM VALUE STRING to the end of the config file if the param is not present
# If PARAM starts with "add:", it will add PARAM VALUE STRING to the end of the document regardless of the existence of the same param in the doc
# If value string == "remove" (lowercase letters), then comment PARAM if it exists
#
# Examples:
Expand Down Expand Up @@ -72,9 +73,10 @@ function setdwconfig() {
# $value has an (empty or non-empty) value:
# if $param exists in file, uncomment if needed and replace the existing value with the new value;
# if $param doesn't exist, add $param and $value to the end of the file
if grep -qo "^\s*#*\s*${param}\b.*$" "$DWCONFIGFILE"; then
if grep -qo "^\s*#*\s*${param}\b.*$" "$DWCONFIGFILE" && [[ "${param:0:4}" != "add:" ]]; then
sed -i "s|^\s*#*\s*${param}\b.*$|${param} ${value}|g" "$DWCONFIGFILE"
else
if [[ "${param:0:4}" == "add:" ]]; then param="${param:4}"; fi
{ echo -n "${param}"
if [[ -n "${value}" ]]; then
echo " ${value}"
Expand Down
11 changes: 6 additions & 5 deletions rootfs/tools/docker-compose.kx1t.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ services:
- DW_DEBUG=togm
- DW_EXTRA_CONFIGS=
TXDELAY=30;
CBEACON every=1:00 delay=0:10 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-parm.pl KX1T-1 time_of_measurment ionizing_bg_radiation";
CBEACON every=1:00 delay=0:12 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-unit.pl KX1T-1 secs_since_epoch nSv/h";
CBEACON every=1:00 delay=0:14 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-data.pl KX1T-1 $(/tools/get_geiger.sh)";
CBEACON every=1:00 delay=0:16 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-bits.pl KX1T-1 11111111 ""https://kx1t.com/geiger Belmont MA"" ";
TBEACON remove
add:CBEACON every=1:00 delay=0:10 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-parm.pl KX1T-1 time_of_measurment ionizing_bg_radiation";
add:CBEACON every=1:00 delay=0:12 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-unit.pl KX1T-1 secs_since_epoch nSv/h";
add:CBEACON every=1:00 delay=0:14 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-data.pl KX1T-1 $(/tools/get_geiger.sh)";
add:CBEACON every=1:00 delay=0:16 SYMBOL=RH VIA=WIDE1-1,WIDE2-1 infocmd="telem-bits.pl KX1T-1 11111111 ""https://kx1t.com/geiger Belmont MA"" ";
TBEACON remove;
SMARTBEACONING remove;
- DW_EXTRA_CMDLINEARGS=-r 48000
- AUDIOLEVEL_TX=64
- DW_TB_COMMENT="Ramon kx1t@amsat.org https://kx1t.com"
Expand Down

0 comments on commit 3d78b12

Please sign in to comment.