WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: how does ondemand for command line utilities work?  (Read 5971 times)

Offline christophed

  • Newbie
  • *
  • Posts: 10
how does ondemand for command line utilities work?
« on: August 28, 2011, 06:33:57 PM »
I've installed (frugally) the latest TinyCore onto an aging Thinkpad T23 (PIII with 256 mb of RAM) and I've been playing with it the latest week. So far I like TC a whole lot! It's been a really nice distro so far, and the wiki answers a lot of questions.

I tend to boot into text (framebuffer) mode primarily and start X only when needed (although this is no microcore install!).

I like AppBrowser and AppAudit for installing and marking applications for OnBoot & OnDemand.

But since I want to keep booting fast I want to keep some CLI tools (like mc) OnDemand.

With mc in OnDemand I get (at the console):
aterm: can't open display : 0

When sudoed, mc runs as expected.

Is this expected behaviour and should I be aware of some CLI restrictions to OnDemand (which I've failed to find in the wiki)?
« Last Edit: August 29, 2011, 06:05:49 PM by christophed »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11755
Re: how does ondemand for command line utilities work?
« Reply #1 on: August 28, 2011, 06:53:34 PM »
Hi christophed
This is just a guess on my part. I think you need to run the  mc  script in  /home/tc/.wmx/OnDemand
(case sensitive) to mount the extension the first time you run it. After the first time just  mc should be
enough until the next time you boot.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #2 on: August 28, 2011, 07:24:28 PM »
You have raised a very good but subtle point. Ondemand for CLI.

ondemand was designed for menu selection to load  and run extensions. As menu items it was designed with X in mind. Ondemand are simple wrapper scripts derived from the extension's freedesktop item, .e.g., /usr/local/share/applications/mc.desktop.  They are persistent in your tce directory in the ondemand sub directory

Your PATH should have ondemand listed last.

If you look at mc in the ondemand directory you see a hosting aterm. Calling aterm  without X will result in the case that you have described. This hosting aterm is from the mc freedesktop item.

Since the ondemand scripts are persistent, you can edit it. Try replacing the last line 'aterm  -e' with 'cliorx'





10+ Years Contributing to Linux Open Source Projects.

Offline christophed

  • Newbie
  • *
  • Posts: 10
Re: how does ondemand for command line utilities work?
« Reply #3 on: August 29, 2011, 04:31:43 PM »
Thanks a lot Rich and roberts for these quick replies: these were exactly the kind of hints I was looking for!
(editing the mc script in the ondemand directory worked perfectly fine).

Overall I think TinyCore is very beautifully built (and because of it's small nature, it's easy to follow what's going on). Thumbs up  :D

Offline christophed

  • Newbie
  • *
  • Posts: 10
Re: how does ondemand for command line utilities work?
« Reply #4 on: August 29, 2011, 06:11:16 PM »
Related: isn't the wrapper script (after the conditional tce-load) for ondemand applications supposed to launch the application afterwards?

The ondemand wrapper for alpine currently does not do this which means:

1. you type 'alpine' (the wrapper script gets called, tce-load does it's magic')
2. the script is done (without afterwards loading alpine itself)
3. the second time you try to issue 'alpine' the shell stills remembers the 'alpine' location from (1) which means you have to issue a 'hash -r' (as suggested on IRC @tinycorelinux by glc_) for being able to start alpine without absolute paths (/usr/local/bin/alpine).

 

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #5 on: August 29, 2011, 07:19:22 PM »
1. Where is the freedesktop item for alpine? Such is required to know how to launch!
    Without such ondemand fallsback to only able to load the extension.

2. tc@dev:~$ echo $PATH
/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/sda1/tce/ondemand

So a second issue of 'alpine' from shell should find /usr/local/bin/alpine before attempting /mnt/sda1/tce/ondemand.




 
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: how does ondemand for command line utilities work?
« Reply #6 on: August 30, 2011, 02:21:52 AM »
mc.tcz got freedesktop menu added just by accident on user's request. alpine do not have it as practically all other console tools are missing it.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #7 on: August 30, 2011, 02:40:01 AM »
Then how would alpine be found/located/accessed on a freedesktop system.
How does one use a freedesktop system to access command line programs?

OnDemand menu relies on freedesktop item to know how/what to launch.

Without such then CLI items becomes available for only those who are familiar.
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: how does ondemand for command line utilities work?
« Reply #8 on: August 30, 2011, 02:55:52 AM »
Current situation is that most of the CLI programs are missing freedesktop menu as they are console tools. You can define of course .desktop to have in the extension as a requirement to support ondemand.

Typically no icon is available for CLI progs (mc is an exception again), so you must specify prog not to display in DE's menu like Xfce4, LXDE, ... In this case what is the extra information you have in .desktop what is not available otherwise? Name in Spanish, Germanm etc. and the category. Taht's all. So, why to have it?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #9 on: August 30, 2011, 02:58:44 AM »
Then this entire thread is based on the inconsistent use of freedesktop item in a console tool.
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: how does ondemand for command line utilities work?
« Reply #10 on: August 30, 2011, 04:33:39 AM »
Then this entire thread is based on the inconsistent use of freedesktop item in a console tool.

A while ago someone asked to add mc icon to WBAR, so I added a freedesktop menu to mc.tcz Personally I also loved it not because of WBAR but I use mc even in LXDE/Xfce4. So it is just an exception. I can imagine further exceptions when a unique CLI application may have a freedesktop menu, but it is not typical and must be taken as an exception, that's all.

The only proper expectation that CLI tools do not have freedesktop menu.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: how does ondemand for command line utilities work?
« Reply #11 on: August 30, 2011, 04:42:16 AM »
Come to think of it, I know of even a little shell script (i.e. 'wifi.sh') that also comes with an icon (and hence a .desktop file in it's extension).

I guess there will always be good reasons to have a few exceptions here or there ...

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #12 on: August 30, 2011, 10:11:41 AM »
By my very remark about alpine, is that even command line extensions could benefit from having a freedesktop item, as base utilities would know how to handle their successful launch. In particular it would not be helpful if wifi.sh was "hidden"!.
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: how does ondemand for command line utilities work?
« Reply #13 on: August 30, 2011, 11:32:07 AM »
By my very remark about alpine, is that even command line extensions could benefit from having a freedesktop item, as base utilities would know how to handle their successful launch. In particular it would not be helpful if wifi.sh was "hidden"!.

This means that all LINUx console tools are hidden :(

You can say alpine is just another execption next to mc. For a packager to find or ctrate a usable is nightmare. Most of us are not Graphics Designers. See TC icons history :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: how does ondemand for command line utilities work?
« Reply #14 on: August 30, 2011, 12:51:29 PM »
If anyone is unable to acknowledge that alpine or other command line extensions could benefit from at minimum a menu to launch cliorx then there is really no point in my trying to innovate further by extending the definition of freedesktop.  I have provided the infrastructure to support this. If the old way of thinking had originally prevailed then there would be no Tiny Core Linux. I am therefore stymied in my endeavor and will refer to maker any complaints about such extensions.
10+ Years Contributing to Linux Open Source Projects.