Switching DMRGateways in Pi-Star

The default DMRGateway in Pi-Star has all DMR networks active with adjustable timeouts/holds, but VE3RD created a DMRGateway that has only one network active at a time, and the user can use multiple ways to switch networks. I have opted for using the TG codes to select network, e.g. TG 9004 selects network 4 for instance, and this lets you use normal TG numbers on each network verses TG translation with the standard DMRGateway. A post on the gateway with Phil’s instructions to install:

https://tgifnetwork.createaforum.com/new-board/brand-new-dmrgateway-4/

There are times I want to use Phil’s DMRGateway and times I like the original DMRGateway. If you save your main DMRGateway config file and Phil’s config file, along with the versions of DMRGateway, you can use a simple bash script to switch between them. The original DMRGateway is good for monitoring multiple networks and talk groups if not too busy as well as having access to XLX reflectors. Phil’s gateway can be advantageous for using actual talk group numbers along with isolating networks, using 7 digit personal talk group numbers on TGIF, or if monitoring busy talk groups on mulitple networks and switching between them.

I setup /etc/dmrgateway.old and /etc/dmrgateway.3rd for the DMRGateway config files, which then can be copied to /etc/dmrgateway

Also setup /usr/local/bin/DMRGateway.old and /usr/local/bin/DMRGateway.3rd to be copied to /usr/local/bin/DMRGateway

Bash script to change to Phil’s version, file gw4 (chmod +x):

#!/bin/bash
systemctl stop mmdvmhost dmrgateway
sleep 1
mount -o remount,rw /
cp /etc/dmrgateway.3rd /etc/dmrgateway
cp /usr/local/bin/DMRGateway.3rd /usr/local/bin/DMRGateway
systemctl restart mmdvmhost dmrgateway
mount -o remount,ro /
echo Installed VE3RD DMRGateway 4 configuration

Bash script to switch back to default DMRGateway, file gw (chmod +x):

#!/bin/bash
systemctl stop mmdvmhost dmrgateway
sleep 1
mount -o remount,rw /
cp /etc/dmrgateway.old /etc/dmrgateway
cp /usr/local/bin/DMRGateway.old /usr/local/bin/DMRGateway
systemctl restart mmdvmhost dmrgateway
mount -o remount,ro /
echo Restored original DMRGateway configuration

I just have the files in the /home/Pi-Star directory. Then to execute from the home directory, sudo ./gw4 or sudo ./gw

This also makes restoring the DMRGateway config files easy if Pi-Star wrecks them with its massive script. If you use Pi-Star to edit the file, be sure to copy it to the .old or .3rd files to preserve the change. Or just edit those files directly and run the script to install. The bash scripts could be improved but just what I came up with on the fly to switch between them easily. It would be neat if this functionality was built into DMRGateway itself and you could switch between these different modes of operation.