--- a/usr/src/lib/liborchestrator/orchestrator_private.h Sun Apr 06 19:03:08 2008 -0600
+++ b/usr/src/lib/liborchestrator/orchestrator_private.h Mon Apr 07 11:45:52 2008 -0700
@@ -106,7 +106,6 @@
#define TOOLS_TEST_CMD "/usr/bin/dummy_tools_install"
#define INSTALLED_ROOT_DIR "/a"
#define PROFILE_NAME "profile"
-#define PROGRESS_FILE "/tmp/install_update_progress.out"
#define HOMEDIR_CREATE_FAILED "mkdir of %s returned error %d\n"
#define BAD_DISK_SLICE "Bad disk slice %s\n"
#define NSI_CHDIR_FAILED "chdir to %s failed with error %d\n"
@@ -114,6 +113,7 @@
#define NSI_CREATE_SLINK_FAILED "Creating symlink of %s failed with error %d\n"
#define NSI_GETCWD_FAILED "getcwd() failed with error %d\n"
#define NSI_TIME_FAILED "time() failed with error %d\n"
+#define NSI_TRANSFER_FAILED "Transfer failed with error %d\n"
#define NSI_MOVE_FILE "Moved %s to %s\n"
#define NSI_LINK_FILE "Linked %s to %s\n"
--- a/usr/src/lib/liborchestrator/perform_slim_install.c Sun Apr 06 19:03:08 2008 -0600
+++ b/usr/src/lib/liborchestrator/perform_slim_install.c Mon Apr 07 11:45:52 2008 -0700
@@ -163,6 +163,7 @@
};
image_info_t image_info = {B_FALSE, 4096, 1.0, "off"};
+int tm_percentage_done = 0;
/*
* local functions
@@ -179,8 +180,8 @@
static void set_system_state(void);
static int trav_link(char **path);
static void write_sysid_state(sys_config *sysconfigp);
-static void notify_error_status(int status);
-static void notify_install_complete();
+static void notify_error_status(int percentage_done);
+static void notify_install_complete(void);
static void enable_nwam();
static void create_user_directory();
static void transfer_log_files(char *target);
@@ -504,11 +505,6 @@
return (OM_FAILURE);
}
- if (fopen(PROGRESS_FILE, "w") == NULL) {
- om_set_error(OM_NO_PROGRESS_FILE);
- return (OM_FAILURE);
- }
-
tcb_args = (struct transfer_callback *)
calloc(1, sizeof (struct transfer_callback));
if (tcb_args == NULL) {
@@ -845,7 +841,9 @@
notify_install_complete();
} else {
- notify_error_status(status);
+ om_debug_print(OM_DBGLVL_WARN, NSI_TRANSFER_FAILED, status);
+ om_log_print(NSI_TRANSFER_FAILED, status);
+ notify_error_status(tm_percentage_done);
}
nvlist_free(transfer_attr);
@@ -868,12 +866,12 @@
om_callback_info_t cb_data;
cb_data.num_milestones = 1;
- cb_data.curr_milestone =
- (percent == 100 ? OM_POSTINSTAL_TASKS:OM_SOFTWARE_UPDATE);
+ cb_data.curr_milestone = OM_SOFTWARE_UPDATE;
cb_data.callback_type = OM_INSTALL_TYPE;
cb_data.percentage_done = percent;
cb_data.message = message;
om_cb(&cb_data, 0);
+ tm_percentage_done = percent;
}
@@ -1544,46 +1542,35 @@
}
/*
- * Write to the pfinstall progress file that there is an error.
- * A callback will be sent to the caller with the error number
+ * Inform GUI of error condition through callback
*/
static void
-notify_error_status(int status)
+notify_error_status(int percentage_done)
{
- FILE *fp;
-
- fp = fopen(PROGRESS_FILE, "a");
- if (fp != NULL) {
- (void) fprintf(fp,
- "%s" \
- " source=\"orchestrator\"" \
- " type=\"install-failure\"" \
- " percent=\"%d\" />\n",
- INSTALLER_FAILED, (int)status);
- /* WRITE it out */
- (void) fclose(fp);
- }
+ om_callback_info_t cb_data;
+
+ cb_data.num_milestones = 1;
+ cb_data.curr_milestone = -1; /* signals error to GUI */
+ cb_data.callback_type = OM_INSTALL_TYPE;
+ cb_data.percentage_done = percentage_done;
+ cb_data.message = NULL;
+ om_cb(&cb_data, 0);
}
/*
- * Write to the install progress file that install is completed
+ * Notify the GUI that the installation is complete
*/
-static void
+static void
notify_install_complete()
{
- FILE *fp;
-
- fp = fopen(PROGRESS_FILE, "a");
- if (fp != NULL) {
- (void) fprintf(fp,
- "%s" \
- " source=\"orchestrator\"" \
- " type=\"solaris-install\"" \
- " percent=\"100\" />\n",
- POST_INSTALL_STATUS);
- /* WRITE it out */
- (void) fclose(fp);
- }
+ om_callback_info_t cb_data;
+
+ cb_data.num_milestones = 1;
+ cb_data.curr_milestone = OM_POSTINSTAL_TASKS;
+ cb_data.callback_type = OM_INSTALL_TYPE;
+ cb_data.percentage_done = 100;
+ cb_data.message = NULL;
+ om_cb(&cb_data, 0);
}
/*