GL-A1300 Custom Switch / Button Config

Hi All,

First dive into the world of GL.iNet Routers and OpenWRT. I’m testing the GL-A1300 with the hope that it’ll be a great solution for work and our employees who require VPN access back to the office along with switching between Router & Access Point Network Modes on the fly.

I’m trying to make this easy, ideally (and option #1) when holding the reset button for xx seconds, I Import a config saved in /root/router_mode.txt which imports a pre-setup router config for day-to-day operations.
Then when holding the reset button for xxx seconds, I recall the Access Point (or as I like to refer to it, Bridge Mode) file (/root/AP_mode.txt) to switch the device over to Access Point network mode.

I’ve had no luck editing the /etc/rc.button/reset file - although I don’t fully believe this is where I should be making changes anyway.

The second option is to do this with the switch. This will remove the convenience of the VPN being switched on/off easily but I change modes of the router far more than needing the VPN switch.

I have successfully created the 2 config backups and can SSH into the device & recall them using:
uci import < /root/ap_mode.txt
reboot

or

uci import < /root/router_mode.txt
reboot

and this works. However, I can’t for the life of me work out how to edit any of the config files for the button or switch to make this work. I have read many, many posts on similar things but the files either are slightly different or not there. My latest failed thought was to edit the TOR file in \etc\gl-switch-d\ so that I could use the GUI to select the Toggle Switch function as TOR and this would achieve what I want along with making it easy to switch back to Wireguard VPN.

For this I simply changed the \etc\gl-switch-d\TOR file to the following:

#!/bin/sh

action=$1

if [ “$action” = “on” ];then
uci import < /root/ap_mode.txt
reboot
fi

if [ “$action” = “off” ];then
uci import < /root/router_mode.txt
reboot
fi

But I get no response at all when I switch from off/on or reverse.

Anyone have any pointers, or have completed this themselves?

TIA.