1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Optware installed correctly? (Toastman build 1.28.0497) - E4200

Discussion in 'Tomato Firmware' started by J.One, Apr 29, 2012.

  1. J.One

    J.One Networkin' Nut Member

    Hi guys,

    I'm just wondering if I installed optware correctly. I followed this guide, and at this part here;

    "How optware integrates with TomatoUSB

    TomatoUSB already has some transparent support for optware. For instance, it automatically adds /opt/bin to the system PATH. Moreover, it will use the /opt/etc/configdirectory to look for administrative scripts:
    • /opt/etc/config/*.fire: All executable files matching this pattern will be executed whenever the firewall needs to be (re-)configured. You can store your firewall configuration here instead of using the web interface (Administration » Scripts » Firewall), to save precious NVRAM space.
    • /opt/etc/config/*.wanup: All executable files matching this pattern will be executed whenever the WAN interface goes up. You can store your WAN-dependent configuration here instead of using the web interface (Administration » Scripts » WAN Up), to save precious NVRAM space.
    The only issue with using these files is that there is a possible race condition at startup: if firewall/wan goes up before optware is mounted (USB can be slow..), those scripts will not have their chance to be executed.
    To workaround this race condition, create the file /opt/.autorun, with the following contens:
    #!/bin/sh if [ -f /var/notice/wan ]; then for s in /opt/etc/config/*.wanup; do $s; done for s in /opt/etc/config/*.fire; do $s; done fi

    Remember to make the file executable: chmod +x /opt/.autorun. This file is automatically executed by TomatoUSB when the partition is mounted (nothing specific with Optware, this is just Tomato's USB subsystem), and will execute the scripts if the WAN is already up by the time it is executed. "

    Now my question(s) are related to the bold parts of the quoted text.

    The question is, do i really need to do this? Or is this only if I want to move the files to the "/opt/etc/config/" directory and save NVRAM space?
    I dont even have the "config" directory in /opt/etc.

    If i decide to ignore this, will optware work like it should?
  2. lancethepants

    lancethepants Network Guru Member

    You can really do it in either place. You could put your firewall rules in the Administratin -> Scripts -> Firewall portion, but you should put startup scripts in USB and NAS -> USB support ->'Run after mounting, to ensure they really run. Really more than one way to do it. I actually prefer to put the optware script in /opt/etc/config like you mentioned. Just create the config directory if it doesn't exist, and place the scripts in there.
  3. J.One

    J.One Networkin' Nut Member

    I'm doing this now, but now my other question is, do I have to move other scripts from someplace to "/otp/etc/config" or just the onces that I newly add myself? I'm thinking about firewall rules etc..
  4. lancethepants

    lancethepants Network Guru Member

    For myself, if the script involves optware, then I put it in /opt/etc/config . Otherwise, if it's independent of optware, I'll put it in the gui. That way, the flash drive can act independently from the rest of the system. If it gets yanked, then the firewalls rules go with it, not opening up any unnecessary ports. I'd like to think I could pop out one flash drive, put in another, reboot, and have an entirely different optware setup begin to work seamlessly. Scripts for applications built into the firmware, like a firewall script to open wan access to snmp for a specific ip (something I use), I feel should be in the gui, and not be dependent on the flash drive. I still need that firewall script to function, even if the flash drive is removed. Hopefully that all makes sense and answers some questions.

    edit: I have several firewall scripts, in both places. Since openvpn is built into the firmware, in the gui I placed several ebtable scripts to block protocols over the VPN. I also have a WOL script in the gui that I need present relentless of whether the USB drive is present or not. I run nginx off optware, and have placed those scripts in /opt/etc/config to open the ports for that optware application.
    J.One likes this.
  5. J.One

    J.One Networkin' Nut Member

    Thanks for the explanation. Now I know more less where to store my scrips.
    It was not all clear for me, the custom scrips, "optware" and all the other stuff I did know about before. I thought Tomato was prepacked with all features like pptp, but then I found out there was a lot more to it.

    The custom scripts, that's something that I have to learn doing, because, allthough I am a Linux user since over a year now, I'm not really into Linux scripting yet. Infact, the only scripts I can write are batch scripts and small SQL scripts :)
    So I'm a long way from home.

    The first thing I want to do be able to do now is get my pptp server to work, and then I can start playing with the custom scripts.
    I think I need to make a script to use one of my LAN ports as secundary WAN port, for a setup box that can't go online from behind a router.

Share This Page