Author: jsuchome
Date: Thu Jun 21 10:19:09 2007
New Revision: 38942
URL: http://svn.opensuse.org/viewcvs/yast?rev=38942&view=rev
Log:
example of SCR agent using squidguard_conf perl package
Added:
trunk/squidguard/agents/ag_squidguard
trunk/squidguard/agents/squidguard.scr
Modified:
trunk/squidguard/agents/Makefile.am
Modified: trunk/squidguard/agents/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squidguard/agents/Makefile.am?rev=38942&r1=38941&r2=38942&view=diff
==============================================================================
--- trunk/squidguard/agents/Makefile.am (original)
+++ trunk/squidguard/agents/Makefile.am Thu Jun 21 10:19:09 2007
@@ -1,7 +1,9 @@
# Makefile.am for squidguard/agents
-agent_SCRIPTS =
+agentdir = @execcompdir@/servers_non_y2
-scrconf_DATA =
+agent_SCRIPTS = ag_squidguard
+
+scrconf_DATA = squidguard.scr
EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA)
Added: trunk/squidguard/agents/ag_squidguard
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squidguard/agents/ag_squidguard?rev=38942&view=auto
==============================================================================
--- trunk/squidguard/agents/ag_squidguard (added)
+++ trunk/squidguard/agents/ag_squidguard Thu Jun 21 10:19:09 2007
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+# FIXME where to get squidguard_conf from?
+# probably default location for perl modules?
+BEGIN {
+ push @INC, '/usr/share/YaST2/modules/';
+}
+
+use ycp;
+use strict;
+use squidguard_conf;
+
+while ( <STDIN> )
+{
+ my ($command, $path, $argument) = ycp::ParseCommand ($_);
+
+ #----------------------------------------------------------
+ # Expected calls:
+ # Read(.squidguard, file_name)
+ # -> returns the configuration map
+ #----------------------------------------------------------
+
+ if ( $command eq "Read" )
+ {
+ y2internal ("path $path, command $command, arg $argument");
+ if ( $path eq '.' ) {
+
+ my $config = squidguard_conf->ReadSquidGuardConf ($argument);
+ ycp::Return ($config);
+ }
+ else {
+ y2error ("wrong path ($path) or argument: ", ref ($argument));
+ ycp::Return("wrong path or argument");
+ }
+ }
+ elsif ($command eq "result")
+ {
+ exit;
+ }
+ else
+ {
+ y2error ("wrong command ($command), only Read is accepted");
+ ycp::Return("wrong command, only Read is accepted");
+ }
+}
+
+# end
Added: trunk/squidguard/agents/squidguard.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squidguard/agents/squidguard.scr?rev=38942&view=auto
==============================================================================
--- trunk/squidguard/agents/squidguard.scr (added)
+++ trunk/squidguard/agents/squidguard.scr Thu Jun 21 10:19:09 2007
@@ -0,0 +1,12 @@
+/**
+ * File: squidguard.scr
+ * Summary: Agent for access squidguard configuration file(s)
+ * Access: read/write
+ * Authors: Jiri Suchomel