zypper script extension

I was surfing through extensions and found one for Ubuntu and wondered how hard it would be to modify it for openSUSE. Source for “Apt-linker” – Userscripts.org

Hello Jonathan_R,

It wouldn’t be difficult to modify it for openSUSE.
The only problem is that Ubuntu has a firefox extension to handle apt:// links.
AFAIK there isn’t such kind of exstension for openSUSE.

Good luck!:wink:

That’s right. There isn’t one yet.

I’m thinking that it’s this bit that needs to be changed.


findAndReplace('\\b(sudo )?(apt-get|aptitude) install (^\\.\\",\\)]*)\\b',
               // '<a href=\"apt://'+'$2'.replace(/\s+/g,',')+'\">$1 install $2</a>';
               function(aptline) {
                 pkgs= aptline.replace(/^.*install /,'').replace(/\s+/g,',');
                 return '<a href=\"apt://'+pkgs+'\">'+aptline+'</a>';
               });

findAndReplace('\\bapt:(//)?\\w,-]+',
               function(apturl) {
                 return '<a href='+apturl+'>'+apturl+'</a>';
               });

Hello Jonathan_R,

I think you’re missing something.
This script will only convert lines like:

  • sudo apt-get install emacs emacs-goodies-el windows-el jde js2-mode
  • aptitude install freepats timidity-interfaces-extra timidity-el tuxguitar
  • $ sudo aptitude install ttf-droid ttf-unifont

And turn them into lines like:

  • apt://<package>

The script doesn’t install anything itself.
Therefor you need another Firefox extension AptURL. (Not sure if it is a extension)
This let’s Firefox support the apt:// protocol and install the package(s)

If you change the script it will for example make this url:

  • zypper://supertux

The problem is that Firefox doesn’t know what to do whit this link.

I hope it’s now clear for you.

Good luck|;)