mydsl-load idiot valve


Forum: DSL Tips and Tricks
Topic: mydsl-load idiot valve
started by: jpeters

Posted by jpeters on Oct. 09 2007,09:34
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.

Posted by mikshaw on Oct. 09 2007,13:09
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.

Posted by Juanito on Oct. 09 2007,14:31
...perhaps mydsl-load could be modified (in the case of uci, unc) to check if an extension with the same name is already mounted?
Posted by mikshaw on Oct. 09 2007,20:01
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.

Posted by jpeters on Oct. 10 2007,07:18
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.

Posted by mikshaw on Oct. 10 2007,12:12
That sounds like it's kinda similar to the way I handle mc and vim. My vim command, for example, is a script that tests for the existence of the executable /opt/vim/bin/vim, and if that succeeds it is used as my editor. The difference is that instead of installing the package if the test fails, it just falls back on /usr/bin/vi

I suppose that could only work if as long as the uci provided a replacement for an application already available in DSL. In your case there is nothing in DSL that could take the place of wine, so you're forced either to load the wine package or fail. Keep in mind that unless you remember to keep the wine uci in the same place all the time, with the same filename, you are still apt to fail in some cases, such as when swapping drives or using portable devices. It might be worth doing a check for the existence of the uci package itself before running mydsl-load...maybe even checking each available partition?

Posted by chaostic on Oct. 12 2007,02:52
How bout making mydsl load check first, and if its already mounted, it prompts for an action (Unload or Cancel).
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.