Mailinglist Archive: yast-commit (396 mails)

< Previous Next >
[yast-commit] r65127 - in /trunk/installation: VERSION package/yast2-installation.changes src/clients/inst_finish.ycp src/inst_finish/random_finish.ycp src/inst_finish/umount_finish.ycp
Author: locilka
Date: Tue Aug 2 13:40:48 2011
New Revision: 65127

URL: http://svn.opensuse.org/viewcvs/yast?rev=65127&view=rev
Log:
- Preserving the /dev/urandom state from inst-sys after the
installation (bnc#692799)
- Automatically enabling haveged service if installed (bnc#692799)
- 2.21.9


Added:
trunk/installation/src/inst_finish/random_finish.ycp
Modified:
trunk/installation/VERSION
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_finish.ycp
trunk/installation/src/inst_finish/umount_finish.ycp

Modified: trunk/installation/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/VERSION?rev=65127&r1=65126&r2=65127&view=diff
==============================================================================
--- trunk/installation/VERSION (original)
+++ trunk/installation/VERSION Tue Aug 2 13:40:48 2011
@@ -1 +1 @@
-2.21.8
+2.21.9

Modified: trunk/installation/package/yast2-installation.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=65127&r1=65126&r2=65127&view=diff
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Tue Aug 2 13:40:48
2011
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Tue Aug 2 13:37:03 CEST 2011 - locilka@xxxxxxx
+
+- Preserving the /dev/urandom state from inst-sys after the
+ installation (bnc#692799)
+- Automatically enabling haveged service if installed (bnc#692799)
+- 2.21.9
+
+-------------------------------------------------------------------
Mon Aug 1 15:38:32 CEST 2011 - locilka@xxxxxxx

- Added control.SLES-for-VMware into the SVN

Modified: trunk/installation/src/clients/inst_finish.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_finish.ycp?rev=65127&r1=65126&r2=65127&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_finish.ycp (original)
+++ trunk/installation/src/clients/inst_finish.ycp Tue Aug 2 13:40:48 2011
@@ -142,6 +142,7 @@
"proxy",
"pkg",
"driver_update1",
+ "random",
// bnc #340733
"system_settings",
],

Added: trunk/installation/src/inst_finish/random_finish.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/inst_finish/random_finish.ycp?rev=65127&view=auto
==============================================================================
--- trunk/installation/src/inst_finish/random_finish.ycp (added)
+++ trunk/installation/src/inst_finish/random_finish.ycp Tue Aug 2 13:40:48
2011
@@ -0,0 +1,74 @@
+/**
+ * File: random_finish.ycp
+ *
+ * Module: Handle haveged service and preserve the current randomness state
+ *
+ * Authors: Lukas Ocilka <locilka@xxxxxxx>
+ *
+ * $Id$
+ */
+
+{
+ textdomain "installation";
+
+ import "FileUtils";
+ import "Service";
+
+ any ret = nil;
+ string func = "";
+ map param = $[];
+
+ /**
+ * Calls a local command and returns if successful
+ */
+ define boolean LocalCommand (string command) {
+ map cmd = (map) WFM::Execute (.local.bash_output, command);
+ y2milestone ("Command %1 returned: %2", command, cmd);
+
+ if (cmd["exit"]:-1 == 0) {
+ return true;
+ } else {
+ if (cmd["stderr"]:"" != "") y2error ("Error: %1", cmd["stderr"]:"");
+ return false;
+ }
+ }
+
+ 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 random_finish");
+ y2debug("func=%1", func);
+ y2debug("param=%1", param);
+
+ if (func == "Info") {
+ return (any) $[
+ "steps" : 1,
+ // progress step title
+ "title" : _("Enabling random number generator..."),
+ "when" : [ `installation, `live_installation, `update, `autoinst ],
+ ];
+ } else if (func == "Write") {
+ string init_path = "/etc/init.d/";
+ string init_service = "haveged";
+
+ // The generator of randomness should be always enabled if possible
+ if (FileUtils::Exists (sformat ("%1/%2", init_path, init_service))) {
+ y2milestone ("Enabling service %1", init_service);
+ ret = Service::Enable (init_service);
+ } else {
+ y2warning ("Cannot enable service %1, %2 is not installed",
+ init_service, sformat ("%1/%2", init_path, init_service));
+ }
+ } else {
+ y2error ("unknown function: %1", func);
+ ret = nil;
+ }
+
+ y2debug("ret=%1", ret);
+ y2milestone("random_finish finished");
+
+ return ret;
+} /* EOF */

Modified: trunk/installation/src/inst_finish/umount_finish.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/inst_finish/umount_finish.ycp?rev=65127&r1=65126&r2=65127&view=diff
==============================================================================
--- trunk/installation/src/inst_finish/umount_finish.ycp (original)
+++ trunk/installation/src/inst_finish/umount_finish.ycp Tue Aug 2 13:40:48
2011
@@ -23,6 +23,7 @@
import "String";
import "Internet";
import "FileUtils";
+import "Mode";

any ret = nil;
string func = "";
@@ -39,6 +40,43 @@
y2debug("func=%1", func);
y2debug("param=%1", param);

+/**
+ * Calls a local command and returns if successful
+ */
+define boolean LocalCommand (string command) {
+ map cmd = (map) WFM::Execute (.local.bash_output, command);
+ y2milestone ("Command %1 returned: %2", command, cmd);
+
+ if (cmd["exit"]:-1 == 0) {
+ return true;
+ } else {
+ if (cmd["stderr"]:"" != "") y2error ("Error: %1", cmd["stderr"]:"");
+ return false;
+ }
+}
+
+void preserve_randomness_state () {
+ string service_bin = "/sbin/haveged";
+ string dev_path = "/dev";
+ string random_path = sformat ("%1/urandom", dev_path);
+
+ ret = true;
+
+ // Preserve the current randomness state
+ if (!Mode::update() && Installation::destdir != "/") {
+ // stop the random number generator service
+ LocalCommand (sformat ("killproc -TERM %1", service_bin));
+
+ // copy the current state of random number generator to the installed
system
+ if (LocalCommand (sformat ("cp -av '%1' '%2/%1'", String::Quote
(random_path), String::Quote (Installation::destdir)))) {
+ y2milestone ("State of %1 has been successfully copied to %2",
random_path, Installation::destdir);
+ } else {
+ y2milestone ("Cannot copy %1 to %2/%1", random_path,
Installation::destdir);
+ ret = false;
+ }
+ }
+}
+
if (func == "Info")
{
return (any)$[
@@ -137,6 +175,13 @@
{
umountLength = umountLength - 1;
string tmp = Installation::destdir + (string)
(umountList[umountLength]:"");
+
+ // This is the very last partition, actually "/"
+ if (umountLength == 0) {
+ // BNC #692799: Preserve the randomness state before umounting
+ preserve_randomness_state();
+ }
+
y2milestone ("umount target: %1", tmp);

boolean umount_status = (boolean) WFM::Execute (.local.umount, tmp);

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages