Author: mzugec Date: Mon Feb 9 18:03:08 2009 New Revision: 55368 URL: http://svn.opensuse.org/viewcvs/yast?rev=55368&view=rev Log: AutoYaST : import Modified: trunk/printer/VERSION trunk/printer/agents/ag_cups trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/src/Printerlib.ycp trunk/printer/yast2-printer.spec.in Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Mon Feb 9 18:03:08 2009 @@ -1 +1 @@ -2.18.1 +2.18.2 Modified: trunk/printer/agents/ag_cups URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/agents/ag_cups?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/agents/ag_cups (original) +++ trunk/printer/agents/ag_cups Mon Feb 9 18:03:08 2009 @@ -107,24 +107,61 @@ return 1; } +sub write_params { + my ($key, $options) = @_; + + my @output=(); + foreach my $params (@$options){ + push (@output, "$key $params"); + } + return @output; +} + sub write_conf { - my ($file, $data_r) = @_; -$file=">/tmp/agent.log"; -my $data=@$data_r[0]; + my ($file, $data) = @_; + my @output = (); -open( WRT, $file ); foreach my $key(keys %$data){ foreach my $options ($$data{$key}){ if ($key eq "sections"){ - print WRT Dumper($options); - }else{ - foreach my $params (@$options){ - print WRT "$key $params\n"; + foreach my $item (@$options){ + + my $section=$$item{'Key'}; + push(@output, "<$section $$item{'Value'}>"); + delete $$item{'Key'}; + delete $$item{'Value'}; + foreach my $key2 (keys %$item){ + if ($key2 eq "sections"){ + + foreach my $subitem (@{$$item{'sections'}}){ + my $subsection=$$subitem{'Key'}; + push(@output, "<$subsection $$subitem{'Value'}>"); + delete $$subitem{'Key'}; + delete $$subitem{'Value'}; + foreach my $key2 (keys %$subitem){ + @output=(@output, write_params($key2, $$subitem{$key2})); + } + push(@output, "$subsection>"); + } + + } else{ + @output=(@output, write_params($key2, $$item{$key2})); + } + } + push(@output, "$section>"); } + }else{ + @output=(@output, write_params($key, $options)); } } } -close(WRT); + + open( OUT, $file ); + foreach my $line (@output){ + print OUT "$line\n"; + } + close(OUT); + return 1; } @@ -150,8 +187,8 @@ sub Write { my $class = shift; my ($path, @args) = @_; - my $server = "< /etc/cups/cupsd.conf"; - my $client = "< /etc/cups/client.conf"; + my $server = "> /etc/cups/cupsd.conf"; + my $client = "> /etc/cups/client.conf"; if ($path eq ".client"){ return write_conf($client, $args[0]); Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Mon Feb 9 18:03:08 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Feb 9 17:58:31 CET 2009 - mzugec@suse.cz + +- AutoYaST : import +- 2.18.2 + +------------------------------------------------------------------- Fri Feb 6 15:48:53 CET 2009 - mzugec@suse.cz - AutoYaST support (bnc#464364) - export only Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Mon Feb 9 18:03:08 2009 @@ -2063,9 +2063,8 @@ * @return boolean True on success */ global boolean Import (map settings) { -y2internal("Import : %1", settings); -// Printerlib::client_conf_server_name = settings["cups_remote_server"]:""; -// Printerlib::WriteCupsSettings(settings["server_settings"]:$[]); + Printerlib::WriteClientSettings(settings["cups_remote_server"]:$[]); + Printerlib::WriteCupsSettings(settings["server_settings"]:$[]); return true; } Modified: trunk/printer/src/Printerlib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printerlib.ycp?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/src/Printerlib.ycp (original) +++ trunk/printer/src/Printerlib.ycp Mon Feb 9 18:03:08 2009 @@ -510,5 +510,21 @@ return true; } +global boolean WriteCupsSettings(map ay){ + string cups_file="/etc/cups/cupsd.conf"; + y2milestone("Create backup of %1 file:%2", cups_file, SCR::Execute(.target.bash, sformat("mv %1 %1.$(date -I)", cups_file))); + SCR::Write(.cups.server, ay); + return true; +} + + +global boolean WriteClientSettings(map ay){ + string cups_file="/etc/cups/client.conf"; + y2milestone("Create backup of %1 file:%2", cups_file, SCR::Execute(.target.bash, sformat("mv %1 %1.$(date -I)", cups_file))); + SCR::Write(.cups.client, ay); + return true; +} + + } Modified: trunk/printer/yast2-printer.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/yast2-printer.spec.in?rev=55368&r1=55367&r2=55368&view=diff ============================================================================== --- trunk/printer/yast2-printer.spec.in (original) +++ trunk/printer/yast2-printer.spec.in Mon Feb 9 18:03:08 2009 @@ -45,6 +45,8 @@ @clientdir@/printer* @yncludedir@/printer/* @schemadir@/autoyast/rnc/printer.rnc +@scrconfdir@/* +@agentdir@/* #data -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org