Skip to content

Commit 61f28c4

Browse files
author
Jiri Svoboda
committed
Only eject installation CD after user confirms restart.
1 parent 0cec807 commit 61f28c4

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

uspace/app/sysinst/sysinst.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static void sysinst_debug(sysinst_t *, const char *);
157157
static void sysinst_futil_copy_file(void *, const char *, const char *);
158158
static void sysinst_futil_create_dir(void *, const char *);
159159
static errno_t sysinst_eject_dev(sysinst_t *, service_id_t);
160+
static errno_t sysinst_eject_phys_by_mp(sysinst_t *, const char *);
160161

161162
static futil_cb_t sysinst_futil_cb = {
162163
.copy_file = sysinst_futil_copy_file,
@@ -271,6 +272,8 @@ static void sysinst_restart_dlg_button(ui_msg_dialog_t *dialog, void *arg,
271272
switch (btn) {
272273
case 0:
273274
/* OK */
275+
sysinst_action(sysinst, "Ejecting installation media.");
276+
(void)sysinst_eject_phys_by_mp(sysinst, CD_MOUNT_POINT);
274277
(void)sysinst_restart(sysinst);
275278
break;
276279
default:
@@ -896,6 +899,9 @@ static errno_t sysinst_eject_phys_by_mp(sysinst_t *sysinst, const char *path)
896899
sysarg_t part_id;
897900
errno_t rc;
898901

902+
log_msg(LOG_DEFAULT, LVL_NOTE,
903+
"sysinst_eject_phys_by_mp(%s)", path);
904+
899905
rc = vol_create(&vol);
900906
if (rc != EOK) {
901907
sysinst_error(sysinst, "Error contacting volume service.");
@@ -939,6 +945,8 @@ static errno_t sysinst_restart(sysinst_t *sysinst)
939945
shutdown_stopped = false;
940946
shutdown_failed = false;
941947

948+
sysinst_action(sysinst, "Restarting the system.");
949+
942950
rc = system_open(SYSTEM_DEFAULT, &sysinst_system_cb, NULL, &system);
943951
if (rc != EOK) {
944952
sysinst_error(sysinst,
@@ -1025,11 +1033,6 @@ static errno_t sysinst_install(sysinst_t *sysinst, const char *dev)
10251033
if (rc != EOK)
10261034
return rc;
10271035

1028-
sysinst_action(sysinst, "Ejecting installation media.");
1029-
rc = sysinst_eject_phys_by_mp(sysinst, CD_MOUNT_POINT);
1030-
if (rc != EOK)
1031-
return rc;
1032-
10331036
return EOK;
10341037
error:
10351038
if (clean_dev)
@@ -1069,6 +1072,8 @@ static errno_t sysinst_install_fibril(void *arg)
10691072
goto error;
10701073

10711074
sysinst_progress_destroy(sysinst->progress);
1075+
sysinst->progress = NULL;
1076+
10721077
rc = sysinst_restart_dlg_create(sysinst);
10731078
if (rc != EOK)
10741079
goto error;
@@ -1247,12 +1252,13 @@ static void sysinst_progress_destroy(sysinst_progress_t *progress)
12471252
*/
12481253
static void sysinst_action(sysinst_t *sysinst, const char *action)
12491254
{
1255+
log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);
1256+
12501257
if (sysinst->progress == NULL)
12511258
return;
12521259

12531260
ui_label_set_text(sysinst->progress->action, action);
12541261
ui_label_paint(sysinst->progress->action);
1255-
log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);
12561262
}
12571263

12581264
/** Set current error message.

0 commit comments

Comments
 (0)