DSL Tips and Tricks :: mydsl-load idiot valve



After inadvertently umounting extensions (incl uci's) by forgetting that I already loaded them, I started including an exit line on mydsl-load scripts, like:


      if find /opt/wine-0.9.28_with_opengl/ &>/dev/null; then exit; fi
     
      mydsl-load /mnt/hda3//wine-0.9.28_with_opengl.unc

Now I can screw up without freezing up my computer.

I can see how it's easy to accidentally unmount a uci, as I used to do it myself quite often.

If you don't mind a little critique, your script could be simplified and be allowed to work without a forced exit:
Code Sample
[ -d /opt/wine-0.9.28_with_opengl ] || mydsl-load /mnt/hda3/wine-0.9.28_with_opengl.unc

This cuts down on the number of commands needed, which translates to smaller code and (possibly) less processing time. It also eliminates the need for exit, which allows you to use this command for multiple uci packages, or to add whatever other commands you might want after the mydsl-load commands.

Personally I haven't used mydsl-load noninteractively, other than the auto-loaded extensions during boot. I tend to use either a dmenu script or a modified version of the ucitool script to manage ucis, both of which visually separate the loaded packages from the available ones to help prevent accidental unloading.

...perhaps mydsl-load could be modified (in the case of uci, unc) to check if an extension with the same name is already mounted?
Then you wouldn't be able to unload uci packages cleanly...the same command is used to load and unload. You'd have to unmount them manually and somehow deal with keeping track of the cloop files in use.

It's much simpler to leave the check to an external script that just doesn't run the mydsl-load command if it's not necessary.

Quote (mikshaw @ Oct. 09 2007,16:01)
It's much simpler to leave the check to an external script that just doesn't run the mydsl-load command if it's not necessary.

I found an even simpler way for the wine.unc example. I have a script, "wine" that mydsl-loads wine.unc, and a script, "fm" that loads Fund Manager (fm.exe).  The "fm" script is:

'wine /mnt/hda3/MyFiles/"Fund Manager"/fm.exe &'

If not already loaded, "fm" installs wine. If it is, Fund Manager loads.

Next Page...
original here.