How do I find script commands for customizing switchaction?

Hi all,

I am looking to customize the AR-750S switch to do the following with the switch…

When ON/RIGHT:

  • DHCP OFF
  • WAN Ethernet Port Untagged and assigned to VLAN1 (for a 3rd switch port).

When OFF/LEFT:

  • DHCP ON
  • WAN Ethernet Port Untagged and assigned to VLAN2 (normal WAN port mode)

I found some helpful threads such as this one, that point out where to modify the scripts, but here are questions I have right now before I dive in further:

  • How can I just “monitor” the unit as I make GUI config changes, and sort of see what commands are being issued for each change. If this is possible, are these commands what I’d use in the script? I am familiar with UART connectivity and have an adapter if that’s the easiest (or safest) approach.
  • What is involved in adding (or removing the) script options to the GUI under Button Settings?
  • I haven’t made any changes yet to the file system. What’s the best way to get a local copy of the unit’s filesystem? I’ve connected via SCP and am familiar with that. Should I download the latest firmware file or just copy files out of the unit?
  • Is anyone using SublimeText for development/editing? I imagine that may help me with the codebase and telling me where functions and things are defined? Any extra packages I’d need?

Update - I’ve already soldered on a serial header to the board and am connected in PuTTY.

or if you run in extroot you have more space for packages and if you screw up anything you just pull out the the usb drive or micro sdcard and revert back and plug it back in.

Any threads on this? I definitely don’t need more room. In fact, if anything I think I’d be looking to free up room as I don’t think I’ll need any of the VPN features for my use. But, booting to SD is appealing, or at least for testing… not sure if that would be faster or slower than the internal storage.

here is how I do it.
in 3 steps

install usb and and required drivers. then reboot

opkg update && opkg install block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb-ohci kmod-usb-uhci

ls /dev/sd*
should show nothing

insert the usb or micro sdcard with a ext4 formatted partition say 256mb-2gb
(microsd must be inserted before boot)

ls /dev/sd*
should show /dev/sda1

now these next commands copy the files over to the sda1

mkdir /mnt/test
mount /dev/sda1 /mnt/test ; tar -C /overlay -cvf - . | tar -C /mnt/test -xf - ; umount /mnt/test

after completed run the next set of commands to write fstab and mount /overlay to sda1 at boot

block detect > /etc/config/fstab; \
sed -i s/option$'\t'enabled$'\t'\'0\'/option$'\t'enabled$'\t'\'1\'/ /etc/config/fstab; \
sed -i s#/mnt/sda1#/overlay# /etc/config/fstab; \
cat /etc/config/fstab;

hit return at end of final line to make sure all commands completed

reboot and verify additional diskspace in luci or
df -h /overlay

2 Likes

Thanks for this! I’ll start here.

Should I be looking for actual commands somewhere or does the unit just work by editing config files and then reloading config?

so you remove the sdcard/usbdrive there will be a structure of
upper
etc/
work

upper contains the root of the os and you can copy or back this up and replace to restore a backup.
just leave etc and work alone

so now if you make a mistake you just pull the usb/microsd out and will boot the orginal config stored in the unit.