Hello community,
here is the log from the commit of package yast2-ntp-client
checked in at Fri Aug 31 18:42:34 CEST 2007.
--------
--- yast2-ntp-client/yast2-ntp-client.changes 2007-08-06 16:16:34.000000000 +0200
+++ /mounts/work_src_done/NOARCH/yast2-ntp-client/yast2-ntp-client.changes 2007-08-31 17:31:07.889721000 +0200
@@ -1,0 +2,11 @@
+Fri Aug 31 17:04:37 CEST 2007 - kmachalkova@suse.cz
+
+- Move all installation-related functionality into separate inst.
+ clients (_proposal and _finish) (FaTE #302192)
+- Do not check for xntp package during installation (#299557, #299238)
+- Call 'ntpdate' to synchronize with NTP server during installation
+ (do not restart the service) (#299238)
+- 'During boot' NTP service start is now default (#302389)
+- 2.15.7
+
+-------------------------------------------------------------------
Old:
----
yast2-ntp-client-2.15.6.tar.bz2
New:
----
yast2-ntp-client-2.15.7.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ntp-client.spec ++++++
--- /var/tmp/diff_new_pack.Z18029/_old 2007-08-31 18:42:21.000000000 +0200
+++ /var/tmp/diff_new_pack.Z18029/_new 2007-08-31 18:42:21.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-ntp-client (Version 2.15.6)
+# spec file for package yast2-ntp-client (Version 2.15.7)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-ntp-client
-Version: 2.15.6
+Version: 2.15.7
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-ntp-client-2.15.6.tar.bz2
+Source0: yast2-ntp-client-2.15.7.tar.bz2
prefix: /usr
BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite
#SLPAPI.pm
@@ -36,7 +36,7 @@
Lukas Ocilka
%prep
-%setup -n yast2-ntp-client-2.15.6
+%setup -n yast2-ntp-client-2.15.7
%build
%{prefix}/bin/y2tool y2autoconf
@@ -74,6 +74,14 @@
/usr/share/YaST2/schema/autoyast/rnc/ntpclient.rnc
%changelog
+* Fri Aug 31 2007 - kmachalkova@suse.cz
+- Move all installation-related functionality into separate inst.
+ clients (_proposal and _finish) (FaTE #302192)
+- Do not check for xntp package during installation (#299557, #299238)
+- Call 'ntpdate' to synchronize with NTP server during installation
+ (do not restart the service) (#299238)
+- 'During boot' NTP service start is now default (#302389)
+- 2.15.7
* Mon Aug 06 2007 - kmachalkova@suse.cz
- Do not allow to edit access control rules if NTP is configured
via DHCP (DHCP may servers distribute their own rule set)
++++++ yast2-ntp-client-2.15.6.tar.bz2 -> yast2-ntp-client-2.15.7.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/dialogs.ycp new/yast2-ntp-client-2.15.7/src/dialogs.ycp
--- old/yast2-ntp-client-2.15.6/src/dialogs.ycp 2007-08-06 16:00:31.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/dialogs.ycp 2007-08-31 17:04:20.000000000 +0200
@@ -4,7 +4,7 @@
* Summary: Dialogs definitions
* Authors: Jiri Srain
*
- * $Id: dialogs.ycp 40007 2007-08-06 14:00:31Z kmachalkova $
+ * $Id: dialogs.ycp 40655 2007-08-31 15:04:20Z kmachalkova $
*/
{
@@ -16,6 +16,7 @@
import "Label";
import "NtpClient";
import "Popup";
+import "Stage";
import "SuSEFirewall";
import "Wizard";
import "Report";
@@ -51,14 +52,22 @@
*/
define symbol ReadDialog() ``{
Wizard::RestoreHelp(HELPS["read"]:"");
-
- // checking for root permissions (#158483)
- if (!Confirm::MustBeRoot())
- return `abort;
-
- NtpClient::AbortFunction = PollAbort;
- boolean ret = NtpClient::Read();
- return ret ? `next : `abort;
+
+ if(Stage::initial())
+ {
+ NtpClient::ProcessNtpConf();
+ return `next;
+ }
+ else
+ {
+ // checking for root permissions (#158483)
+ if (!Confirm::MustBeRoot())
+ return `abort;
+
+ NtpClient::AbortFunction = PollAbort;
+ boolean ret = NtpClient::Read();
+ return ret ? `next : `abort;
+ }
}
/**
@@ -66,6 +75,9 @@
* @return `abort if aborted and `next otherwise
*/
define symbol WriteDialog() ``{
+ if (Stage::initial())
+ return `next;
+
Wizard::RestoreHelp(HELPS["write"]:"");
NtpClient::AbortFunction = PollAbort;
boolean ret = NtpClient::Write();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/helps.ycp new/yast2-ntp-client-2.15.7/src/helps.ycp
--- old/yast2-ntp-client-2.15.6/src/helps.ycp 2007-08-06 15:15:49.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/helps.ycp 2007-08-10 12:25:19.000000000 +0200
@@ -4,7 +4,7 @@
* Summary: Help texts of all the dialogs
* Authors: Jiri Srain
*
- * $Id: helps.ycp 40001 2007-08-06 13:15:48Z kmachalkova $
+ * $Id: helps.ycp 40156 2007-08-10 10:25:18Z kmachalkova $
*/
{
@@ -45,12 +45,13 @@
<b>Run NTP Daemon in Chroot Jail</b>. Starting any daemon in a chroot jail
is more secure and strongly recommended.</p>"),
- "secure" : _("<p><b><big>Restricting NTP Service</big></b><br>
+ "secure" : _("<p><b><big>Secure NTP Configuration</big></b><br>
By selecting the option <b>Restrict NTP Service to Configured Servers Only</b>
-you prohibit general access to NTP service on your computer and restrict it
-only to those servers listed in <i>/etc/ntp.conf</i> and localhost. Access
-control flags can be fine-tuned by editing corresponding server entry in
-servers overview table. This option is however not available, if NTP is
+you prohibit all remote hosts to view and modify NTP settings on your
+computer. In this way NTP service is restricted only to those servers listed
+in <i>/etc/ntp.conf</i> and localhost.<br>
+Access control flags can be fine-tuned by editing corresponding server entry
+in servers overview table. This option is not available if NTP is
configured via DHCP.</p>"),
// help text 3/5
@@ -143,10 +144,11 @@
<i>/usr/share/doc/packages/xntp-doc/html/confopt.htm</i>.</p>"),
"restrict" : _("<p><b><big>Access Control Options</big></b><br>
-Here you can define access control flags (<i>restrict</i> directive in <i>
-/etc/ntp.conf</i>) for this server, indicating which type of packets you
-wish to accept from it. This option is only available if you have
-chosen <b>Restrict NTP Service to Configured Servers Only</b> option in
+Here you can define access control flags (<b><i>restrict</i></b> directive in
+<i>/etc/ntp.conf</i>) for this server, indicating which types of actions remote
+host can perform on your NTP daemon. By default, it is set to <i>notrap
+nomodify noquery</i> This option is only available if you have checked
+<b>Restrict NTP Service to Configured Servers Only</b> option in
<b>Security Settings</b>.</p>
"),
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/Makefile.am new/yast2-ntp-client-2.15.7/src/Makefile.am
--- old/yast2-ntp-client-2.15.6/src/Makefile.am 2007-05-18 10:56:19.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/Makefile.am 2007-08-31 10:33:18.000000000 +0200
@@ -8,7 +8,9 @@
client_DATA = \
ntp-client.ycp \
- ntp-client_auto.ycp
+ ntp-client_auto.ycp \
+ ntp-client_proposal.ycp \
+ ntp-client_finish.ycp
ynclude_DATA = \
helps.ycp \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/Makefile.in new/yast2-ntp-client-2.15.7/src/Makefile.in
--- old/yast2-ntp-client-2.15.6/src/Makefile.in 2007-06-15 17:10:45.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/Makefile.in 2007-08-31 11:29:48.000000000 +0200
@@ -187,7 +187,9 @@
YCPCFLAGS = -I .
client_DATA = \
ntp-client.ycp \
- ntp-client_auto.ycp
+ ntp-client_auto.ycp \
+ ntp-client_proposal.ycp \
+ ntp-client_finish.ycp
ynclude_DATA = \
helps.ycp \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/ntp-client_auto.ycp new/yast2-ntp-client-2.15.7/src/ntp-client_auto.ycp
--- old/yast2-ntp-client-2.15.6/src/ntp-client_auto.ycp 2007-07-26 17:32:55.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/ntp-client_auto.ycp 2007-08-31 17:04:20.000000000 +0200
@@ -4,7 +4,7 @@
* Summary: Client for autoinstallation
* Authors: Jiri Srain
*
- * $Id: ntp-client_auto.ycp 39724 2007-07-26 15:32:56Z kmachalkova $
+ * $Id: ntp-client_auto.ycp 40655 2007-08-31 15:04:20Z kmachalkova $
*
* This is a client for autoinstallation. It takes its arguments,
* goes through the configuration and return the setting.
@@ -87,18 +87,11 @@
else if (func == "Write") {
import "Progress";
boolean progress_orig = Progress::set (false);
- //restart_service - also do 'rcntpd restart' and trigger time change
- //otherwise - only write ntp.conf and stuff (default for autoyast)
- if (param["restart_services"]:false == false)
- NtpClient::write_only = true;
+ NtpClient::write_only = true;
ret = NtpClient::Write();
Progress::set (progress_orig);
}
-else if (func == "GetNtpServersByCountry") {
- string cc = param["country"]:NtpClient::GetCurrentLanguageCode();
- ret = NtpClient::GetNtpServersByCountry( cc );
-}
/* Unknown function */
else {
y2error("Unknown function: %1", func);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/ntp-client_finish.ycp new/yast2-ntp-client-2.15.7/src/ntp-client_finish.ycp
--- old/yast2-ntp-client-2.15.6/src/ntp-client_finish.ycp 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ntp-client-2.15.7/src/ntp-client_finish.ycp 2007-08-31 15:17:15.000000000 +0200
@@ -0,0 +1,58 @@
+/**
+ * File: clients/ntp-client_finish.ycp
+ * Summary: Installation client for writing ntp configuration
+ * at the end of 1st stage
+ * Author: Bubli
+ *
+ */
+{
+textdomain "ntp-client";
+
+import "NtpClient";
+
+any ret = nil;
+string func = "";
+map param = $[];
+
+/* Check arguments */
+if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string)WFM::Args(0);
+ if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
+ param = (map)WFM::Args(1);
+}
+
+y2milestone ("starting ntp-client_finish");
+y2debug("func=%1", func);
+y2debug("param=%1", param);
+
+if (func == "Info")
+{
+ return (any)$[
+ "steps" : 1,
+ // progress step title
+ "title" : _("Writing NTP Configuration..."),
+ "when" : [ `installation, `autoinst ],
+ ];
+}
+else if (func == "Write")
+{
+ map ex = NtpClient::Export();
+
+ NtpClient::Read();
+
+ NtpClient::Import( ex );
+
+ NtpClient::Write();
+
+}
+else
+{
+ y2error ("unknown function: %1", func);
+ ret = nil;
+}
+
+y2debug("ret=%1", ret);
+y2milestone("ntp-client_finish finished");
+return ret;
+
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/ntp-client_proposal.ycp new/yast2-ntp-client-2.15.7/src/ntp-client_proposal.ycp
--- old/yast2-ntp-client-2.15.6/src/ntp-client_proposal.ycp 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ntp-client-2.15.7/src/ntp-client_proposal.ycp 2007-08-31 17:17:11.000000000 +0200
@@ -0,0 +1,168 @@
+/**
+ * File: clients/ntp-client_proposal.ycp
+ * Summary: Installation client for ntp configuration
+ * Author: Bubli
+ *
+ */
+
+{
+textdomain "ntp-client";
+
+import "Hostname";
+import "NetworkService";
+import "NtpClient";
+import "Service";
+import "String";
+import "Stage";
+import "Package";
+import "Pkg";
+
+y2milestone("----------------------------------------");
+y2milestone("Ntp client proposal started");
+y2milestone("Arguments: %1", WFM::Args());
+
+any ret = nil;
+string func = "";
+map param = $[];
+
+if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string)WFM::Args(0);
+ if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
+ param = (map)WFM::Args(1);
+}
+
+void ProposeSomething()
+{
+ list ntp_items = [];
+ if( NtpClient::already_proposed || NtpClient::ProcessNtpConf() )
+ {
+ ntp_items = maplist(string server, NtpClient::GetUsedNtpServers(),{
+ return `item(`id(server), server);
+ });
+ }
+ if( ntp_items == [])
+ {
+ string cc = param["country"]:NtpClient::GetCurrentLanguageCode();
+ y2milestone("Nothing found in /etc/ntp.conf, proposing current language-based NTP server list");
+ ntp_items = NtpClient::GetNtpServersByCountry( cc, true );
+ NtpClient::already_proposed = true;
+ }
+ UI::ChangeWidget(`id(`ntp_address), `Items, ntp_items);
+
+}
+
+void AddSingleServer( string server )
+{
+ NtpClient::selected_record["address"] = server;
+ NtpClient::selected_record["type"] = "server";
+ NtpClient::storeSyncRecord();
+}
+
+if (func == "CreateUI")
+{
+ term cont =
+ `Left (`VBox ( `id(`ntp_content),
+ `Left (`RadioButton (`id (`ntp), `opt (`notify),
+ // radio button label
+ _("Synchronize with NTP Server"), false)
+ ),
+ `VSpacing (0.5),
+ `HBox (
+ `HSpacing (3),
+ `MinWidth (38,
+ `ComboBox (`id (`ntp_address), `opt (`editable),
+ // combo box label
+ _("NTP Server Address")
+ )
+ ),
+ `VBox (
+ `Label (""),
+ // push button label
+ `PushButton (`id (`ntp_configure), _("Configure..."))
+ )
+ )
+ ));
+
+ if (UI::WidgetExists(`id(`rp)))
+ {
+ UI::ReplaceWidget(`id(`rp), cont);
+
+ if (!NetworkService::isNetworkRunning())
+ {
+ y2warning("Network is not running, NTP synchronization will not be available");
+ UI::ChangeWidget(`id(`ntp_content), `Enabled, false);
+ }
+
+ //does not really work ideally, need something better pkg binding :(
+ if (!Package::Available("xntp"))
+ {
+ y2warning("xntp package is not installable, NTP synchronization will not be available");
+ UI::ChangeWidget(`id(`ntp_content), `Enabled, false);
+ }
+ }
+
+ ret = true;
+}
+
+else if (func == "MakeProposal")
+{
+ ProposeSomething();
+ ret = true;
+}
+
+else if (func == "Write")
+{
+ string ntp_server = (string) UI::QueryWidget(`id(`ntp_address), `Value);
+ if (!Hostname::CheckFQ(ntp_server))
+ {
+ UI::SetFocus(`id(`ntp_address));
+ ret = `invalid_hostname;
+ }
+ else
+ {
+ y2milestone("Running ntpdate to sync with %1", ntp_server);
+
+ integer status = 0;
+ string service_name = "ntp";
+
+ //Stop NTP service on running system (during 1st stage, we don't care)
+ if( !Stage::initial() && status == 0)
+ {
+ Service::Stop(service_name);
+ }
+
+ //Schedule package for installation
+ Pkg::PkgInstall("xntp");
+
+ 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() && status == 0)
+ {
+ Service::Start(service_name);
+ }
+
+ if (r == 0)
+ {
+ ret = `success;
+ AddSingleServer(ntp_server);
+ }
+ else
+ ret = `ntpdate_failed;
+ }
+}
+
+else if (func == "AskUser")
+{
+ string ntp_server = (string) UI::QueryWidget(`id(`ntp_address), `Value);
+ AddSingleServer(ntp_server);
+ ret = (symbol) WFM::CallFunction("ntp-client");
+ ProposeSomething();
+}
+
+y2milestone("Ntp client proposal finished");
+y2milestone("----------------------------------------");
+return ret;
+}
+
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ntp-client-2.15.6/src/NtpClient.ycp new/yast2-ntp-client-2.15.7/src/NtpClient.ycp
--- old/yast2-ntp-client-2.15.6/src/NtpClient.ycp 2007-07-27 15:55:51.000000000 +0200
+++ new/yast2-ntp-client-2.15.7/src/NtpClient.ycp 2007-08-31 17:04:20.000000000 +0200
@@ -4,7 +4,7 @@
* Summary: Data for configuration of ntp-client, input and output functions.
* Authors: Jiri Srain
*
- * $Id: NtpClient.ycp 39727 2007-07-26 16:15:06Z kmachalkova $
+ * $Id: NtpClient.ycp 40655 2007-08-31 15:04:20Z kmachalkova $
*
* Representation of the configuration of ntp-client.
* Input and output routines.
@@ -58,7 +58,7 @@
/**
* Should the daemon be started when system boots?
*/
-global boolean run_service = false;
+global boolean run_service = true;
/**
* Service name of the NTP daemon
@@ -124,6 +124,8 @@
global boolean simple_dialog = false;
+global boolean already_proposed = false;
+
/**
* Abort function
* @return blah blah lahjk
@@ -156,7 +158,7 @@
//workaround bug #241054: servers in United Kingdom are in domain .uk
// domain .gb does not exist - add UK to the list of known countries
- if (haskey(known_countries, "GB")){
+ if (haskey(known_countries, "GB")){
known_countries["UK"] = known_countries["GB"]:"";
known_countries = remove(known_countries,"GB");
}
@@ -238,9 +240,10 @@
/**
* Get list of public NTP servers for a country
* @param country two-letter country code
+ * @param terse_output display additional data (location etc.)
* @return list of servers (usable as combo-box items)
*/
-global list GetNtpServersByCountry ( string country ) {
+global list GetNtpServersByCountry ( string country, boolean terse_output ) {
map country_names = $[];
map > servers = GetNtpServers ();
if (country != "")
@@ -255,7 +258,7 @@
}
list items = maplist (string s, map o, servers, {
- string label = o["location"]:"";
+ string label = o["location"]:"";
string l_country = o["country"]:"";
if (country != "")
l_country = "";
@@ -267,7 +270,11 @@
label = s;
else
label = sformat ("%1 (%2%3)", s, label, l_country);
- return `item (`id (s), label);
+
+ if (terse_output)
+ return `item (`id(s), s);
+ else
+ return `item (`id (s), label);
});
return items;
@@ -275,79 +282,22 @@
}
/**
- * Read all ntp-client settings
+ * Read and parse /etc.ntp.conf
* @return true on success
*/
-global define boolean Read() ``{
-
- /* NtpClient read dialog caption */
- string caption = _("Initializing NTP Client Configuration");
-
- integer steps = 2;
- integer sl = 500;
- // We do not set help text here, because it was set outside
- Progress::New( caption, " ", steps, [
- // progress stage
- _("Read network configuration"),
- // progress stage
- _("Read NTP settings"),
- ], [
- // progress step
- _("Reading network configuration..."),
- // progress step
- _("Reading NTP settings..."),
- // progress step
- _("Finished")
- ],
- ""
- );
-
- // read network configuration
- if(Abort()) return false;
- Progress::NextStage();
-
- boolean progress_orig = Progress::set (false);
- NetworkDevices::Read ();
- Progress::set (progress_orig);
- config_dhcp = tolower ((string)SCR::Read (.sysconfig.network.dhcp.DHCLIENT_MODIFY_NTP_CONF)) == "yes";
- original_config_dhcp = config_dhcp;
-
- GetNtpServers ();
- GetCountryNames ();
- // read current settings
- if(Abort()) return false;
- Progress::NextStage();
+global define boolean ProcessNtpConf() ``{
- boolean failed = false;
+ map conf = nil;
+ if (FileUtils::Exists("/etc/ntp.conf"))
+ conf = (map)SCR::Read (.etc.ntp_conf.all);
- if (! Mode::testsuite ()
- && ! PackageSystem::CheckAndInstallPackagesInteractive (["xntp"])
- )
+ if (conf == nil )
{
+ y2error("Failed to read /etc/ntp.conf, either it doesn't exist or contains no data");
return false;
}
- run_service = Service::Enabled (service_name);
-
- //Poke to /var/lib/YaST if there is Active Directory controller address dumped in .ycp file
- string ad_ntp_file = Directory::vardir + "/ad_ntp_data.ycp";
- if(FileUtils::Exists(ad_ntp_file)) {
- y2milestone("Reading %1", ad_ntp_file);
- map ad_ntp_data = (map ) SCR::Read(.target.ycp, ad_ntp_file);
- ad_controller = ad_ntp_data["ads"]:"";
- if(ad_controller != "") {
- y2milestone("Got %1 for ntp sync, deleting %2, since it is no longer needed", ad_controller, ad_ntp_file);
- SCR::Execute(.target.remove, ad_ntp_file);
- }
- }
-
-
- map conf = (map)SCR::Read (.etc.ntp_conf.all);
- if (conf == nil)
- {
- failed = true;
- conf = $[];
- }
+ already_proposed = true;
list