Author: kmachalkova
Date: Fri Aug 31 17:04:20 2007
New Revision: 40655
URL: http://svn.opensuse.org/viewcvs/yast?rev=40655&view=rev
Log:
New ntp installation client to handle ntp settings
in 1st stage added + related changes in r/w functions
(FaTE #302192, bugzilla #(#299238,#299557,#302389,
#302433)
Added:
trunk/ntp-client/src/ntp-client_finish.ycp
trunk/ntp-client/src/ntp-client_proposal.ycp
Modified:
trunk/ntp-client/src/Makefile.am
trunk/ntp-client/src/NtpClient.ycp
trunk/ntp-client/src/dialogs.ycp
trunk/ntp-client/src/ntp-client_auto.ycp
trunk/ntp-client/src/widgets.ycp
Modified: trunk/ntp-client/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/Makefile.am?rev=40655&r1=40654&r2=40655&view=diff
==============================================================================
--- trunk/ntp-client/src/Makefile.am (original)
+++ trunk/ntp-client/src/Makefile.am Fri Aug 31 17:04:20 2007
@@ -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 \
Modified: trunk/ntp-client/src/NtpClient.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/NtpClient.ycp?rev=40655&r1=40654&r2=40655&view=diff
==============================================================================
--- trunk/ntp-client/src/NtpClient.ycp (original)
+++ trunk/ntp-client/src/NtpClient.ycp Fri Aug 31 17:04:20 2007
@@ -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();
+global define boolean ProcessNtpConf() ``{
- 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;
+ map conf = nil;
+ if (FileUtils::Exists("/etc/ntp.conf"))
+ conf = (map)SCR::Read (.etc.ntp_conf.all);
- GetNtpServers ();
- GetCountryNames ();
- // read current settings
- if(Abort()) return false;
- Progress::NextStage();
-
- boolean failed = false;
-
- if (! Mode::testsuite () && ! Mode::installation ()
- && ! 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