I would like to setup a laptop on Linux to use two different autofs config according to the network it is plugged. I have the two working autofs files (see below) and I would like to swap automatically between them.
I have considered tinkering with name resolutions (providing same logical name on two networks) or writing a ifup.d script (check ip or gateway addr, copy the right script and restart autofs). At this time I realized my need is not that exotic (not for autofs files, but for any configuration files) and I wonder if there is existing tools, or best practice, to achieve this kind of behavior1.
On network1:
foo -rw,intr,nfsvers=3 bar.network1:/export/baz/&
On network2:
foo -rw,intr,nfsvers=3 qux.network2:/export/baz/&
1. Quick googling with keywords swap|switch network configurations mainly raise answers about network configuration (ip, gateway, dns...).