Skip to content
jsuchome edited this page Aug 14, 2012 · 11 revisions

Gloves Tutorial!

First of all you need checkout the sources and install needed the ruby gems:

git clone [email protected]:openSUSE/gloves.git

Follow the README file, doc/architecture.txt document and install needed dependencies:

sudo zypper ar http://download.opensuse.org/repositories/YaST:/Head:/YaST++/openSUSE_12.2

sudo zypper in rubygem-ruby-augeas rubygem-packaging_rake_tasks

Run rake install from the gloves directory:

sudo rake install

Don't forget to set the permissions for your user. Edit /etc/polkit-1/localauthority/50.local.d/org.opensuse.config_agent.pkla file and enable everything or you can experiment with more granularity.

First Step: Run an example:

~/yast--> ./gloves-country/examples/timezone_conf

{"hwclock"=>"--localtime", "default_timezone"=>"US/Eastern", "timezone"=>"Europe/Prague"}

Next Step: Own gloves module:

It's time to write your own gloves module now. We'll start with the config_agent, the low level part:

mkdir config_agent-windowmanager

cd config_agent-windowmanager

Use the config agent generator to generate the skeleton for your code:

config-agent-generator file /etc/sysconfig/windowmanager

Add some lines of code to the skelleton:

vi services/file/windowmanager.rb

Add your code to the read() and write() functions. You might want to use augeas for config file reading/writing. Make sure not to return nil values as they are not supported by dbus and will result in an error message like "Message did not receive a reply (timeout by message bus) (DBus::Error)"

Next part is the ylib:

mkdir gloves-windowmanager

cd gloves-windowmanager

mkdir ./lib/y_lib

Create your code, use another module for copy&paste:

vi ./lib/glove/windowmanager.rb

And finally the last part: An example application copy&paste is your friend :-)

mkdir examples

vi examples/windowmanager_conf

It's time to play...FINAL JEOPARDY!

./examples/windowmanager_conf

Hopefully everything works fine. Otherwise see the logs for debugging in /var/log/config_agents/*

Clone this wiki locally