Skip to content

Commit

Permalink
syncing time before starting the installation
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Jul 14, 2015
1 parent ae4672c commit f7ae845
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/modules/AutoinstGeneral.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import "Pkg";
import "ProductFeatures";
import "Storage";
import "Report";
import "Popup";

// All shared data are in yast2.rpm to break cyclic dependencies
import "AutoinstData";
Expand Down Expand Up @@ -221,6 +223,35 @@
);
}


/**
* NTP syncing
*/
global define void NtpSync()
{
if( haskey( mode, "ntp_sync_time_before_installation" ))
{
string ntp_server = "";
ntp_server = mode["ntp_sync_time_before_installation"]:"";
y2milestone("NTP syncing with %1", ntp_server);
Popup::ShowFeedback(
_("Syncing time..."),
/* TRANSLATORS: %1 is the name of the ntp server */
sformat(_("Syncing time with %1."), ntp_server));
if(SCR::Execute(.target.bash, sformat("/usr/sbin/ntpdate -b %1", ntp_server)) > 0)
{
Report::Error(_("Time syncing failed."));
}
else
{
if(SCR::Execute(.target.bash, "/sbin/hwclock --systohc") > 0)
Report::Error(_("Cannot update system time."));
}
Popup::ClearFeedback();
}
}


/**
* Write General Configuration
* @return boolean true on success
Expand Down Expand Up @@ -272,6 +303,8 @@
Mouse::Set(AutoinstData::mouse["id"]:"");
}
SetSignatureHandling();

NtpSync();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/schema/general.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ final_reboot =
element final_reboot { BOOLEAN }
forceboot =
element forceboot { BOOLEAN }
ntp_sync_time_before_installation =
ntp_sync_time_before_installation {text}
halt =
element halt { BOOLEAN }
second_stage =
Expand Down

0 comments on commit f7ae845

Please sign in to comment.