Author: jsuchome Date: Tue Jul 1 11:50:05 2008 New Revision: 48708 URL: http://svn.opensuse.org/viewcvs/yast?rev=48708&view=rev Log: added .sys2hw command to ag_time Modified: branches/tmp/lslezak/workshop/country/timezone/agents/ag_time branches/tmp/lslezak/workshop/country/timezone/src/Timezone.ycp Modified: branches/tmp/lslezak/workshop/country/timezone/agents/ag_time URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/country/timezone/agents/ag_time?rev=48708&r1=48707&r2=48708&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/country/timezone/agents/ag_time (original) +++ branches/tmp/lslezak/workshop/country/timezone/agents/ag_time Tue Jul 1 11:50:05 2008 @@ -51,21 +51,54 @@ if ($hwclock eq "--utc" && $timezone) { $cmd = "TZ=$timezone ".$cmd; } -y2internal ("cmd: $cmd"); my $out = `LANG=C $cmd 2>&1`; if ($out) { - y2error ("cmd returned: $out"); + y2error ("cmd ($cmd) returned: $out"); ycp::Return("false"); } else { -# TODO cmd = "/sbin/hwclock --hctosys $hwlock" - ycp::Return("true"); + $cmd = "/sbin/hwclock --hctosys $hwclock"; + $out = `LANG=C $cmd 2>&1`; + if ($out) { + y2error ("cmd ($cmd) returned: $out"); + ycp::Return("false"); + } + else { + ycp::Return("true"); + } } } } elsif ($path eq '.sys2hw') { - y2error ("path $path not implemented yet"); - ycp::Return("false"); + + if (!defined $argument) { + y2error ("argument is missing"); + ycp::Return("false"); + } + elsif (ref ($argument) ne "HASH") { + y2error ("argument must be a hash"); + ycp::Return("false"); + } + elsif (!$argument->{"hwclock"}) { + y2error ("hwclock key is missing"); + ycp::Return("false"); + } + else { + my $hwclock = $argument->{"hwclock"}; + my $timezone = $argument->{"timezone"}; + my $cmd = "/sbin/hwclock --systohc $hwclock"; + if ($hwclock eq "--utc" && $timezone) { + $cmd = "TZ=$timezone ".$cmd; + } + my $out = `LANG=C $cmd 2>&1`; + if ($out) { + y2error ("cmd ($cmd) returned: $out"); + ycp::Return("false"); + } + else { + ycp::Return("true"); + } + } } else { y2error ("wrong path ($path) or argument type: ", ref ($argument)); Modified: branches/tmp/lslezak/workshop/country/timezone/src/Timezone.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/country/timezone/src/Timezone.ycp?rev=48708&r1=48707&r2=48708&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/country/timezone/src/Timezone.ycp (original) +++ branches/tmp/lslezak/workshop/country/timezone/src/Timezone.ycp Tue Jul 1 11:50:05 2008 @@ -387,6 +387,7 @@ if (!Arch::s390 ()) { + /* string cmd = ""; if (size (timezone) >0 && hwclock != "--localtime") { @@ -395,6 +396,11 @@ cmd = "/sbin/hwclock --systohc " + hwclock; y2milestone ("cmd %1", cmd); SCR::Execute(.target.bash, cmd); + */ + SCR::Write (.time.sys2hw, $[ + "hwclock" : hwclock, + "timezone" : timezone + ]); } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org