Author: mvidner Date: Wed Oct 15 13:25:01 2008 New Revision: 52232 URL: http://svn.opensuse.org/viewcvs/yast?rev=52232&view=rev Log: Use sntp instead of ntpdate which is obsolete (bnc#431516). Modified: trunk/ntp-client/VERSION trunk/ntp-client/data/get_servers.pl trunk/ntp-client/data/test_servers.pl trunk/ntp-client/package/yast2-ntp-client.changes trunk/ntp-client/src/NtpClient.ycp trunk/ntp-client/src/ntp-client_proposal.ycp Modified: trunk/ntp-client/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/VERSION?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/VERSION (original) +++ trunk/ntp-client/VERSION Wed Oct 15 13:25:01 2008 @@ -1 +1 @@ -2.17.3 +2.17.4 Modified: trunk/ntp-client/data/get_servers.pl URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/data/get_servers.pl?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/data/get_servers.pl (original) +++ trunk/ntp-client/data/get_servers.pl Wed Oct 15 13:25:01 2008 @@ -1,5 +1,13 @@ #!/usr/bin/perl -w +my $sntp = "/usr/sbin/sntp"; +if (! -x $sntp) { + $sntp = "/usr/bin/msntp"; # debian + if (! -x $sntp) { + die "No sntp client found"; + } +} + my $ntp_status = `LANG=C /etc/init.d/ntp status`; if ($ntp_status =~ /\.\.running/) { warn "NTP daemon is running\nPlease, turn it off before running this script...\n\n"; @@ -90,7 +98,7 @@ #test all of them @servers = grep { my $hostname = $_->{"address"}; - my $status = system ("sudo /usr/sbin/ntpdate -q $hostname"); + my $status = system ("$sntp $hostname"); $status == 0; } @servers; Modified: trunk/ntp-client/data/test_servers.pl URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/data/test_servers.pl?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/data/test_servers.pl (original) +++ trunk/ntp-client/data/test_servers.pl Wed Oct 15 13:25:01 2008 @@ -3,6 +3,14 @@ use ycp; use Data::Dumper; +my $sntp = "/usr/sbin/sntp"; +if (! -x $sntp) { + $sntp = "/usr/bin/msntp"; # debian + if (! -x $sntp) { + die "No sntp client found"; + } +} + open (IN, "ntp_servers.ycp"); my $ok = 0; my $failed = 0; @@ -14,7 +22,15 @@ if ($line =~ /\"address\".*:.*\"(.+)\"/) { my $server = $1; - my $status = system ("sudo /usr/sbin/ntpdate -q $server"); + my $status = system ("$sntp $server"); + if ($? & 127) + { + if (($? & 127) == 3) + { + exit; + } + print "Use SIGQUIT to quit\n"; + } if ($status == 0) { print "$server is accessible.\n"; Modified: trunk/ntp-client/package/yast2-ntp-client.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/package/yast2-ntp-client.changes?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/package/yast2-ntp-client.changes (original) +++ trunk/ntp-client/package/yast2-ntp-client.changes Wed Oct 15 13:25:01 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Oct 15 13:24:52 CEST 2008 - mvidner@suse.cz + +- Use sntp instead of ntpdate which is obsolete (bnc#431516). +- 2.17.4 + +------------------------------------------------------------------- Sun Oct 12 21:54:08 CEST 2008 - mvidner@suse.cz - Removed a check that was too expensive and made potential failures Modified: trunk/ntp-client/src/NtpClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/NtpClient.ycp?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/src/NtpClient.ycp (original) +++ trunk/ntp-client/src/NtpClient.ycp Wed Oct 15 13:25:01 2008 @@ -915,39 +915,21 @@ `Left(`Label(_("Testing the NTP server..."))) ); - integer status = -1; - //Do not do anything to ntp service during installation - if ( !Stage::initial() ) - { - status = Service::Status (service_name); - //Stop service temporarily (otherwise ntpdate won't work) - //0 means service is running - if ( status == 0) - Service::Stop (service_name); - } y2milestone ("Testing reachability of server %1", server); // testing the server using IPv4 and then using IPv6 protocol // bug #74076, Firewall could have been blocked IPv6 integer ret_IPv4 = (integer) SCR::Execute (.target.bash, sformat ( - "/usr/sbin/ntpdate -4 -q %1", + "/usr/sbin/sntp -4 %1", server )); integer ret_IPv6 = 0; if (ret_IPv4 != 0) ret_IPv6 = (integer) SCR::Execute (.target.bash, sformat ( - "/usr/sbin/ntpdate -6 -q %1", + "/usr/sbin/sntp -6 %1", server )); - //Do not do anything to ntp service during installation - if ( !Stage::initial() ) - { - //Start the service if it was running - if ( status == 0) - Service::Start (service_name); - } - if (verbosity != `no_ui) { UI::CloseDialog(); } Modified: trunk/ntp-client/src/ntp-client_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/ntp-client_proposal.ycp?rev=52232&r1=52231&r2=52232&view=diff ============================================================================== --- trunk/ntp-client/src/ntp-client_proposal.ycp (original) +++ trunk/ntp-client/src/ntp-client_proposal.ycp Wed Oct 15 13:25:01 2008 @@ -177,6 +177,8 @@ // get the value from UI only when it wasn't given as a parameter ntp_server = (string) UI::QueryWidget(`id(`ntp_address), `Value); + // One-time adjusment without running the ntp daemon + // Meanwhile, ntpdate was replaced by sntp boolean ntpdate_only = param["ntpdate_only"]:false; if ( !ValidateSingleServer( ntp_server ) ) @@ -207,31 +209,14 @@ } } - integer status = -1; - string service_name = NtpClient::service_name; - Popup::ShowFeedback("", _("Synchronizing with NTP server...")); - //Stop NTP service on running system (during 1st stage, we don't care) - if( !Stage::initial()) - { - status = Service::Status (service_name); - //Stop service temporarily (otherwise ntpdate won't work) - //0 means service is running - if ( status == 0) - Service::Stop (service_name); - } - - y2milestone("Running ntpdate to sync with %1", ntp_server); + y2milestone("Running sntp to sync with %1", ntp_server); - integer r = (integer) SCR::Execute (.target.bash, sformat ("/usr/sbin/ntpdate '%1'", String::Quote(ntp_server))); - y2milestone ("'ntpdate %1' returned %2", ntp_server, r); - - if( !Stage::initial()) - { - if( status == 0 ) - Service::Start(service_name); - } + // -r: do set the system time + // -P no: do not ask if time difference is too large + integer r = (integer) SCR::Execute (.target.bash, sformat ("/usr/sbin/sntp -r -P no '%1'", String::Quote(ntp_server))); + y2milestone ("'sntp %1' returned %2", ntp_server, r); Popup::ClearFeedback(); @@ -239,7 +224,7 @@ { ret = `success; - // User wants to more than running ntpdate (synchronize on boot) + // User wants to more than running sntp (synchronize on boot) if (!ntpdate_only) { NtpClient::modified = true; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org