diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2010-02-03 10:28:19 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2010-02-03 10:28:19 -0800 |
commit | e018935284c05841f7a85f9733ccb1b2e461e10b (patch) | |
tree | 163e43424b28ff4aac085b97b761a2920ac3b39d | |
parent | e869d50ced2a6c65c9be714de2ec631e950d4a1f (diff) |
195.36.03195.36.03
-rw-r--r-- | DRIVER_VERSION | 2 | ||||
-rw-r--r-- | command-list.c | 79 | ||||
-rw-r--r-- | command-list.h | 4 | ||||
-rw-r--r-- | ncurses-ui.c | 8 | ||||
-rw-r--r-- | stream-ui.c | 6 |
5 files changed, 71 insertions, 28 deletions
diff --git a/DRIVER_VERSION b/DRIVER_VERSION index 4baa759..43be9b5 100644 --- a/DRIVER_VERSION +++ b/DRIVER_VERSION @@ -1 +1 @@ -195.30 +195.36.03 diff --git a/command-list.c b/command-list.c index fcc19a8..57db6ef 100644 --- a/command-list.c +++ b/command-list.c @@ -224,24 +224,31 @@ CommandList *build_command_list(Options *op, Package *p) * may be on a filesystem that doesn't support selinux attributes, * such as NFS. * - * See bug 530083 - "nvidia-installer: ERROR: Failed to execute - * execstack: Operation not supported". + * Since execstack also changes the file on disk, we need to run it + * after the file is installed but before we compute and log its CRC in + * the backup log. To achieve that, we tell INTALL_CMD to run execstack + * as a post-install step. + * + * See bugs 530083 and 611327 */ + if (op->selinux_enabled && + (op->utils[EXECSTACK] != NULL) && + (p->entries[i].flags & FILE_TYPE_SHARED_LIB)) { + tmp = nvstrcat(op->utils[EXECSTACK], " -c ", + p->entries[i].dst, NULL); + } else { + tmp = NULL; + } + if (p->entries[i].flags & installable_files) { add_command(c, INSTALL_CMD, p->entries[i].file, p->entries[i].dst, + tmp, p->entries[i].mode); } - if (op->selinux_enabled && - (op->utils[EXECSTACK] != NULL) && - (p->entries[i].flags & FILE_TYPE_SHARED_LIB)) { - tmp = nvstrcat(op->utils[EXECSTACK], " -c ", - p->entries[i].dst, NULL); - add_command(c, RUN_CMD, tmp); - nvfree(tmp); - } + nvfree(tmp); /* * delete the temporary libGL.la and .desktop files generated @@ -389,6 +396,7 @@ void free_command_list(Options *op, CommandList *cl) c = &cl->cmds[i]; if (c->s0) free(c->s0); if (c->s1) free(c->s1); + if (c->s2) free(c->s2); } if (cl->cmds) free(cl->cmds); @@ -397,7 +405,30 @@ void free_command_list(Options *op, CommandList *cl) } /* free_command_list() */ +/* + * execute_run_command() - execute a RUN_CMD from the command list. + */ + +static inline int execute_run_command(Options *op, float percent, const char *cmd) +{ + int ret; + char *data; + ui_expert(op, "Executing: %s", cmd); + ui_status_update(op, percent, "Executing: `%s` " + "(this may take a moment...)", cmd); + ret = run_command(op, cmd, &data, TRUE, 0, TRUE); + if (ret != 0) { + ui_error(op, "Failed to execute `%s`: %s", cmd, data); + ret = continue_after_error(op, "Failed to execute `%s`", cmd); + if (!ret) { + nvfree(data); + return FALSE; + } + } + if (data) free(data); + return TRUE; +} /* execute_run_command() */ /* * execute_command_list() - execute the commands in the command list. @@ -409,7 +440,6 @@ int execute_command_list(Options *op, CommandList *c, const char *title, const char *msg) { int i, ret; - char *data; float percent; ui_status_begin(op, title, msg); @@ -432,27 +462,23 @@ int execute_command_list(Options *op, CommandList *c, c->cmds[i].s1); if (!ret) return FALSE; } else { + /* + * perform post-install step before logging the backup + */ + if (c->cmds[i].s2 && + !execute_run_command(op, percent, c->cmds[i].s2)) { + return FALSE; + } + log_install_file(op, c->cmds[i].s1); append_to_rpm_file_list(op, &c->cmds[i]); } break; case RUN_CMD: - ui_expert(op, "Executing: %s", c->cmds[i].s0); - ui_status_update(op, percent, "Executing: `%s` " - "(this may take a moment...)", c->cmds[i].s0); - ret = run_command(op, c->cmds[i].s0, &data, TRUE, 0, TRUE); - if (ret != 0) { - ui_error(op, "Failed to execute `%s`: %s", - c->cmds[i].s0, data); - ret = continue_after_error(op, "Failed to execute `%s`", - c->cmds[i].s0); - if (!ret) { - nvfree(data); - return FALSE; - } + if (!execute_run_command(op, percent, c->cmds[i].s0)) { + return FALSE; } - if (data) free(data); break; case SYMLINK_CMD: @@ -973,6 +999,7 @@ static void add_command(CommandList *c, int cmd, ...) c->cmds[n].cmd = cmd; c->cmds[n].s0 = NULL; c->cmds[n].s1 = NULL; + c->cmds[n].s2 = NULL; c->cmds[n].mode = 0x0; va_start(ap, cmd); @@ -983,6 +1010,8 @@ static void add_command(CommandList *c, int cmd, ...) c->cmds[n].s0 = nvstrdup(s); s = va_arg(ap, char *); c->cmds[n].s1 = nvstrdup(s); + s = va_arg(ap, char *); + c->cmds[n].s2 = nvstrdup(s); c->cmds[n].mode = va_arg(ap, mode_t); break; case BACKUP_CMD: diff --git a/command-list.h b/command-list.h index 5e70a1e..196f4d3 100644 --- a/command-list.h +++ b/command-list.h @@ -37,6 +37,7 @@ typedef struct { int cmd; char *s0; char *s1; + char *s2; mode_t mode; } Command; @@ -61,7 +62,8 @@ typedef struct { * commands: * * INSTALL - install the file named is s0, giving it the name in s1; - * assign s1 the permissions specified by mode + * assign s1 the permissions specified by mode; execute the string in s2 as a + * post-install step * * BACKUP - move the file named in s0, storing it in the backup * directory and recording the data as appropriate. diff --git a/ncurses-ui.c b/ncurses-ui.c index 847ad8f..bb1fa32 100644 --- a/ncurses-ui.c +++ b/ncurses-ui.c @@ -1992,10 +1992,18 @@ static TextRows *nv_ncurses_create_command_list_textrows(DataStruct *d, case INSTALL_CMD: perms = nv_ncurses_mode_to_permission_string(c->mode); len = strlen(c->s0) + strlen(c->s1) + strlen(perms) + 64; + if (c->s2) { + len += strlen(c->s2) + 64; + } str = (char *) malloc(len + 1); snprintf(str, len, "Install the file '%s' as '%s' with " "permissions '%s'", c->s0, c->s1, perms); free(perms); + if (c->s2) { + len = strlen(c->s2) + 64; + snprintf(str + strlen(str), len, + " then execute the command `%s`", c->s2); + } break; case RUN_CMD: diff --git a/stream-ui.c b/stream-ui.c index 6e7806c..1df9d23 100644 --- a/stream-ui.c +++ b/stream-ui.c @@ -331,6 +331,9 @@ int stream_approve_command_list(Options *op, CommandList *cl, fmtoutp(prefix, "install the file '%s' as '%s' with " "permissions '%s'", c->s0, c->s1, perms); free(perms); + if (c->s2) { + fmtoutp(prefix, "execute the command `%s`", c->s2); + } break; case RUN_CMD: @@ -353,7 +356,8 @@ int stream_approve_command_list(Options *op, CommandList *cl, default: fmterrp("ERROR: ", "Error in CommandList! (cmd: %d; s0: '%s';" - "s1: '%s'; mode: %04o)", c->cmd, c->s0, c->s1, c->mode); + "s1: '%s'; s2: '%s'; mode: %04o)", + c->cmd, c->s0, c->s1, c->s2, c->mode); fmterr("Aborting installation."); return FALSE; break; |