Mailinglist Archive: yast-commit (815 mails)
| < Previous | Next > |
[yast-commit] r40549 - in /trunk/metapackage/src: OneClickInstall.ycp OneClickInstallUI.ycp
- From: benjimanw@xxxxxxxxxxxxxxxx
- Date: Tue, 28 Aug 2007 18:12:07 -0000
- Message-id: <20070828181207.CB9D9BA4BC@xxxxxxxxxxxxxxxx>
Author: benjimanw
Date: Tue Aug 28 20:12:07 2007
New Revision: 40549
URL: http://svn.opensuse.org/viewcvs/yast?rev=40549&view=rev
Log:
Fixes bug #305354 (Failure when run as root) and bad appearance when
using YMPs with no description or for the wrong distribution.
Modified:
trunk/metapackage/src/OneClickInstall.ycp
trunk/metapackage/src/OneClickInstallUI.ycp
Modified: trunk/metapackage/src/OneClickInstall.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstall.ycp?rev=40549&r1=40548&r2=40549&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstall.ycp (original)
+++ trunk/metapackage/src/OneClickInstall.ycp Tue Aug 28 20:12:07 2007
@@ -656,6 +656,54 @@
}
/**
+ * @return Whether we have anything to do
+ * Determine whether we have a proper metapackage, useful as we can't throw exceptions.
+ **/
+ global boolean HaveAnythingToDo()
+ {
+ return ((size(repositories) > 0) && (size(software) > 0));
+ }
+
+ /**
+ * @return Whether we have a bundle description for the whole bundle
+ * Build service isn't currently generating one for YMPs for individual packages.
+ **/
+ global boolean HaveBundleDescription()
+ {
+ return ((description != "") && (summary != "") && ( name != ""));
+ }
+
+ /**
+ * @return Whether we have any recommended repositories or packages
+ * If not we will have to show advanced view.
+ **/
+ global boolean HaveAnyRecommended()
+ {
+ boolean rec = false;
+ foreach (string name, map<string,string> softwareDetails, software,
+ {
+ if (
+ (softwareDetails["action"]:"install" == "install") &&
+ (softwareDetails["recommended"]:"false" == "true")
+ )
+ rec = true;
+ return true;
+ });
+ foreach (string url, map<string,string> repoDetails, repositories,
+ {
+ if (
+ (repoDetails["recommended"]:"false" == "true")
+ )
+ {
+ rec = true;
+ return true;
+ }
+ });
+ return rec;
+ }
+
+
+ /**
* Converts our map -> map structure to a list of maps with a "key" element.
* This is friendly for yast's XML serialisation support.
**/
Modified: trunk/metapackage/src/OneClickInstallUI.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallUI.ycp?rev=40549&r1=40548&r2=40549&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstallUI.ycp (original)
+++ trunk/metapackage/src/OneClickInstallUI.ycp Tue Aug 28 20:12:07 2007
@@ -308,6 +308,15 @@
$["id": "nothing", "widget":nothing]
];
}
+
+ //Don't display simple mode if not appropriate
+ if (!OneClickInstall::HaveAnythingToDo() || !OneClickInstall::HaveBundleDescription() || !OneClickInstall::HaveAnyRecommended())
+ {
+ installation_steps = installation_steps_advanced;
+ installation_widgets = installation_widgets_advanced;
+ }
+
+
/** </region> **/
/** <region name="wizardy bits"> **/
@@ -576,7 +585,16 @@
string communication_file =(string)SCR::Read (.target.tmpdir) + SEPARATOR + "oneclickinstall.xml";
OneClickInstall::ToXML(communication_file);
- integer ret = (integer)SCR::Execute (.target.bash, SU_CMD + " '/sbin/yast2 OneClickInstallWorker " + communication_file + "'");
+ //Check if we are already root #305354
+ map out = (map) SCR::Execute (.target.bash_output, "/usr/bin/id --user");
+ boolean root = out["stdout"]:"" == "0\n";
+ if(root)
+ {
+ WFM::call("OneClickInstallWorker",[communication_file]);
+ } else
+ {
+ integer ret = (integer)SCR::Execute (.target.bash, SU_CMD + " '/sbin/yast2 OneClickInstallWorker " + communication_file + "'");
+ }
//Load the response.
OneClickInstallWorkerResponse::FromXML(communication_file);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Aug 28 20:12:07 2007
New Revision: 40549
URL: http://svn.opensuse.org/viewcvs/yast?rev=40549&view=rev
Log:
Fixes bug #305354 (Failure when run as root) and bad appearance when
using YMPs with no description or for the wrong distribution.
Modified:
trunk/metapackage/src/OneClickInstall.ycp
trunk/metapackage/src/OneClickInstallUI.ycp
Modified: trunk/metapackage/src/OneClickInstall.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstall.ycp?rev=40549&r1=40548&r2=40549&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstall.ycp (original)
+++ trunk/metapackage/src/OneClickInstall.ycp Tue Aug 28 20:12:07 2007
@@ -656,6 +656,54 @@
}
/**
+ * @return Whether we have anything to do
+ * Determine whether we have a proper metapackage, useful as we can't throw exceptions.
+ **/
+ global boolean HaveAnythingToDo()
+ {
+ return ((size(repositories) > 0) && (size(software) > 0));
+ }
+
+ /**
+ * @return Whether we have a bundle description for the whole bundle
+ * Build service isn't currently generating one for YMPs for individual packages.
+ **/
+ global boolean HaveBundleDescription()
+ {
+ return ((description != "") && (summary != "") && ( name != ""));
+ }
+
+ /**
+ * @return Whether we have any recommended repositories or packages
+ * If not we will have to show advanced view.
+ **/
+ global boolean HaveAnyRecommended()
+ {
+ boolean rec = false;
+ foreach (string name, map<string,string> softwareDetails, software,
+ {
+ if (
+ (softwareDetails["action"]:"install" == "install") &&
+ (softwareDetails["recommended"]:"false" == "true")
+ )
+ rec = true;
+ return true;
+ });
+ foreach (string url, map<string,string> repoDetails, repositories,
+ {
+ if (
+ (repoDetails["recommended"]:"false" == "true")
+ )
+ {
+ rec = true;
+ return true;
+ }
+ });
+ return rec;
+ }
+
+
+ /**
* Converts our map -> map structure to a list of maps with a "key" element.
* This is friendly for yast's XML serialisation support.
**/
Modified: trunk/metapackage/src/OneClickInstallUI.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallUI.ycp?rev=40549&r1=40548&r2=40549&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstallUI.ycp (original)
+++ trunk/metapackage/src/OneClickInstallUI.ycp Tue Aug 28 20:12:07 2007
@@ -308,6 +308,15 @@
$["id": "nothing", "widget":nothing]
];
}
+
+ //Don't display simple mode if not appropriate
+ if (!OneClickInstall::HaveAnythingToDo() || !OneClickInstall::HaveBundleDescription() || !OneClickInstall::HaveAnyRecommended())
+ {
+ installation_steps = installation_steps_advanced;
+ installation_widgets = installation_widgets_advanced;
+ }
+
+
/** </region> **/
/** <region name="wizardy bits"> **/
@@ -576,7 +585,16 @@
string communication_file =(string)SCR::Read (.target.tmpdir) + SEPARATOR + "oneclickinstall.xml";
OneClickInstall::ToXML(communication_file);
- integer ret = (integer)SCR::Execute (.target.bash, SU_CMD + " '/sbin/yast2 OneClickInstallWorker " + communication_file + "'");
+ //Check if we are already root #305354
+ map out = (map) SCR::Execute (.target.bash_output, "/usr/bin/id --user");
+ boolean root = out["stdout"]:"" == "0\n";
+ if(root)
+ {
+ WFM::call("OneClickInstallWorker",[communication_file]);
+ } else
+ {
+ integer ret = (integer)SCR::Execute (.target.bash, SU_CMD + " '/sbin/yast2 OneClickInstallWorker " + communication_file + "'");
+ }
//Load the response.
OneClickInstallWorkerResponse::FromXML(communication_file);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |