Adding smart to YaST

I thought it might be fun if I did this. At this point, I’m just tinkering. But one could add yum or apt4rpm/synaptic as well, or even all.

I did try going to #yast they said

<mvidner> Jonathan_R: you could add an icon to the yast control center to call some smart-gui
<Jonathan_R> well yeah
<Jonathan_R> but how would i do that
<Jonathan_R> that is a start
<Jonathan_R> it might be fun to use the yast software manager gui for the gui front end of the smart cli
<Jonathan_R> i’m just tinkering right now
<mvidner> Jonathan_R: see /usr/share/applications/YaST
<Jonathan_R> just trying to see whats possible
<bubli> mvidner: That wouldn’t help. It is necessary, but not sufficient condition
<mvidner> Jonathan_R: oh. that would be hard, I think
<Jonathan_R> at this point i’d settle for something like this
<Jonathan_R> adding smart as an option
<bubli> Everything in /usr/share/applications/YaST is executed as ‘/sbin/yast [X-SuSE-YaST-Call]’
<Jonathan_R> so that a user could choose software manager or smart
<bubli> while value of X-SuSE-YaST-Call must be a YaST client
<Jonathan_R> ok
<Jonathan_R> so how sould I get 1) the smart gui icon to show in software
<Jonathan_R> and 2) to get that to be called and work

So I checked all that out. The file /sbin/yast is pastebin - collaborative debugging tool which I don’t see how to do as they suggest and add [X-SuSE-YaST-Call]

So apparently ya need to add this code

{ // begin

//===================================================================
// Start smart either Text (commandline) or GUI mode
//-------------------------------------------------------------------
integer status = 0;

if (UI::TextMode())
{
        y2milestone("Running smart in command line mode.");
    Popup::Error(_("Cannot run smart in text-mode"));
        status = (integer)UI::RunInTerminal("/usr/bin/smart");
}
else
{
        y2milestone("Running smart in GUI mode.");
        status = (integer)SCR::Execute(.target.bash, "/usr/bin/smart");
}

y2milestone("smart finished with exit code: <%1>", status);
if (status == 0) {
        return `next;
}
return `nil;

}

and put it here /usr/share/YaST2/clients The same would be true for yum or synaptic. As far as the icons, add an icon to YaST control centre you’ll need 1) create .new .desktop file alike to those already present in /usr/share/applications/YaST2

I hope this helps someone other than me. It was fun.

Much thanks to bubli in #yast for writing the ycp code and helping me with this.

Actually, I had to do some debugging. The code looks like this

{ // begin

//===================================================================
// Start smart either Text (commandline) or GUI mode
//-------------------------------------------------------------------
integer status = 0;

if (UI::TextMode())
{
        y2milestone("Running smart in command line mode.");
    // Popup::Error(_("Cannot run smart in text-mode"));
        status = (integer)UI::RunInTerminal("/usr/bin/smart --shell");
}
else
{
        y2milestone("Running smart in GUI mode.");
    // Popup::Error(_("Cannot run smart in GUI-mode"));
        status = (integer)SCR::Execute(.target.bash, "/usr/bin/smart --gui");
}

y2milestone("smart finished with exit code: <%1>", status);
if (status == 0) {
        return `next;
}
return `nil;

}

By default, it brings up the smart gui. Now as I said, you can modify this so that you could have yumex or synaptic if you wanted.

> By default, it brings up the smart gui. Now as I said, you can modify
> this so that you could have yumex or synaptic if you wanted.

i think what you have done has a lot of ‘neat’ appeal, but i wonder
what is the added benefit of having YaST launch smart, rather than
directly placing smart in the menu system and click on it instead of
YaST…

or, you could make a menu item which launched a window where you could
then have an icon to choose between:

YaST
Smart
Yumex (whatever that is)
Synaptic/Apt
a root powered CLI
whatever…


palladium

I’m not sure what you mean by “window where you could
then have an icon” Here is what it looks like on my end ImageShack - Best place for all of your image hosting and image sharing needs](http://www.imagehosting.com/)

I had to put the smart icon in /usr/share/YaST2/theme/openSUSE/icons/32x32 to get it to show up in YaST. The smart.desktop file looks like this

[Desktop Entry]

Type=Application
Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-Software;

X-KDE-ModuleType=Library
X-KDE-RootOnly=true
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2
X-SuSE-YaST-Call=smart

X-SuSE-YaST-Group=Software
X-SuSE-YaST-Argument=
X-SuSE-YaST-RootOnly=true
X-SuSE-YaST-AutoInst=
X-SuSE-YaST-Geometry=
X-SuSE-YaST-AutoInstResource=

Icon=smart
Exec=/sbin/yast2 smart

Name=Smart Package Manager
GenericName=A next generation package manager written in python that functions on multiple distributions
X-KDE-SubstituteUID=true
StartupNotify=true

For more info on ycp see http://forgeftp.novell.com/yast/doc/SL10.2/tdg/Book-YaSTReference.html

@palladium

Yes, I am aware. Infact, I have smart as a quick launch on my bottom pannel.

Just as a point of interest, you can use the script, modify it of course, to put any admin app into YaST. Guarddog, firestarter, cups, and so on. Now you know how to make YaST into whatever you want.

Pretty impressive Jonathan_R. And easier to grasp without the side issues of the missing posts.

Hi
I’m assuming the X reference can be changed for the GTK/Gnome version?


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
up 17 days 5:40, 3 users, load average: 0.06, 0.02, 0.00
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

Indeed, … I think that ability to use the ability to edit YaST for many aspects is the neat thing about this thread. I think the observation made that one can also put icons (for launching applications) in places other than YaST are very negative in the context of this thread, and are a Red herring to what you have shown us.

YaST is a place where many of us go to to find a GUI to help configure aspects of our PCs, and its really neat to read up on someone adding to YaST.

Thanks for your posts!

Nice one Jonathan. It means if sax2 will still exist in opensuse 11.2 final we still can add it in yast.:cool:

Good observation. :slight_smile:

sax2 runs on openSUSE-11.2 RC1, and at this late stage prior to the GM release I doubt that they will remove it.

Any volunteers to try this (adding sax2) ? :slight_smile:

I’ll do it once I get openSUSE 11.2. Basically it should be the same thing, just in the *ycp file change smart --shell or smart --gui to sax2 and whatever options you want. Then add the appropriate icon the the specified place, and modify the *.desktop file for sax2.

This is what my YaST looks like now.
http://img39.imageshack.us/img39/7226/yast2.th.png](http://img39.imageshack.us/i/yast2.png/)

Just to bump this, and as a friendly reminder, those of you complaining about SaX2 being removed from YaST, you can add it back yourself, by following the above steps.