diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2011-10-22 11:22:10 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2011-10-22 11:22:10 -0700 |
commit | 8e95f7baf4f9c0200cb0ccf6dd0f86aa1ce6efb8 (patch) | |
tree | 2b2ed73ff805420a3504c1b95e1d6e3b96c7de79 | |
parent | a381beed4c168a10362b24331d806e2756d00104 (diff) |
290.03290.03
-rw-r--r-- | log.c | 148 | ||||
-rw-r--r-- | misc.h | 2 | ||||
-rw-r--r-- | nvidia-installer.c | 2 | ||||
-rw-r--r-- | nvidia-installer.h | 2 | ||||
-rw-r--r-- | stream-ui.c | 4 | ||||
-rw-r--r-- | user-interface.c | 24 | ||||
-rw-r--r-- | version.mk | 2 |
7 files changed, 48 insertions, 136 deletions
@@ -76,10 +76,11 @@ static FILE *log_file_stream; * and the state of all noteworthy options. */ -void log_init(Options *op) +void log_init(Options *op, int argc, char * const argv[]) { time_t now; char *path; + int i; if (!op->logging) return; @@ -106,122 +107,10 @@ void log_init(Options *op) log_printf(op, TRUE, NULL, "PATH: %s", STRSTR(path)); log_printf(op, TRUE, NULL, ""); - log_printf(op, TRUE, NULL, "option status:"); - log_printf(op, TRUE, NULL, " license pre-accepted : %s", - BOOLSTR(op->accept_license)); - log_printf(op, TRUE, NULL, " update : %s", - BOOLSTR(op->update)); - log_printf(op, TRUE, NULL, " force update : %s", - BOOLSTR(op->force_update)); - log_printf(op, TRUE, NULL, " expert : %s", - BOOLSTR(op->expert)); - log_printf(op, TRUE, NULL, " uninstall : %s", - BOOLSTR(op->uninstall)); - log_printf(op, TRUE, NULL, " driver info : %s", - BOOLSTR(op->driver_info)); - log_printf(op, TRUE, NULL, " precompiled interfaces : %s", - BOOLSTR(!op->no_precompiled_interface)); - log_printf(op, TRUE, NULL, " no ncurses color : %s", - BOOLSTR(op->no_ncurses_color)); - log_printf(op, TRUE, NULL, " query latest version : %s", - BOOLSTR(op->latest)); - log_printf(op, TRUE, NULL, " no questions : %s", - BOOLSTR(op->no_questions)); - log_printf(op, TRUE, NULL, " silent : %s", - BOOLSTR(op->silent)); - log_printf(op, TRUE, NULL, " no recursion : %s", - BOOLSTR(op->no_recursion)); - log_printf(op, TRUE, NULL, " no backup : %s", - BOOLSTR(op->no_backup)); - log_printf(op, TRUE, NULL, " kernel module only : %s", - BOOLSTR(op->kernel_module_only)); - log_printf(op, TRUE, NULL, " sanity : %s", - BOOLSTR(op->sanity)); - log_printf(op, TRUE, NULL, " add this kernel : %s", - BOOLSTR(op->add_this_kernel)); - log_printf(op, TRUE, NULL, " no runlevel check : %s", - BOOLSTR(op->no_runlevel_check)); - log_printf(op, TRUE, NULL, " no network : %s", - BOOLSTR(op->no_network)); - log_printf(op, TRUE, NULL, " no ABI note : %s", - BOOLSTR(op->no_abi_note)); - log_printf(op, TRUE, NULL, " no RPMs : %s", - BOOLSTR(op->no_rpms)); - log_printf(op, TRUE, NULL, " no kernel module : %s", - BOOLSTR(op->no_kernel_module)); - log_printf(op, TRUE, NULL, " force SELinux : %s", - SELINUXSTR(op->selinux_option)); - log_printf(op, TRUE, NULL, " no X server check : %s", - BOOLSTR(op->no_x_check)); - log_printf(op, TRUE, NULL, " no cc version check : %s", - BOOLSTR(op->ignore_cc_version_check)); - log_printf(op, TRUE, NULL, " run distro scripts : %s", - BOOLSTR(op->run_distro_scripts)); - log_printf(op, TRUE, NULL, " no nouveau check : %s", - BOOLSTR(op->no_nouveau_check)); - log_printf(op, TRUE, NULL, " run nvidia-xconfig : %s", - BOOLSTR(op->run_nvidia_xconfig)); - log_printf(op, TRUE, NULL, " sigwinch work around : %s", - BOOLSTR(op->sigwinch_workaround)); - log_printf(op, TRUE, NULL, " force tls : %s", - TLSSTR(op->which_tls)); -#if defined(NV_X86_64) - log_printf(op, TRUE, NULL, " force compat32 tls : %s", - TLSSTR(op->which_tls_compat32)); -#endif - log_printf(op, TRUE, NULL, " X install prefix : %s", - STRSTR(op->x_prefix)); - log_printf(op, TRUE, NULL, " X library install path : %s", - STRSTR(op->x_library_path)); - log_printf(op, TRUE, NULL, " X module install path : %s", - STRSTR(op->x_module_path)); - log_printf(op, TRUE, NULL, " OpenGL install prefix : %s", - STRSTR(op->opengl_prefix)); - log_printf(op, TRUE, NULL, " OpenGL install libdir : %s", - STRSTR(op->opengl_libdir)); -#if defined(NV_X86_64) - log_printf(op, TRUE, NULL, " compat32 install chroot : %s", - STRSTR(op->compat32_chroot)); - log_printf(op, TRUE, NULL, " compat32 install prefix : %s", - STRSTR(op->compat32_prefix)); - log_printf(op, TRUE, NULL, " compat32 install libdir : %s", - STRSTR(op->compat32_libdir)); -#endif - log_printf(op, TRUE, NULL, " utility install prefix : %s", - STRSTR(op->utility_prefix)); - log_printf(op, TRUE, NULL, " utility install libdir : %s", - STRSTR(op->utility_libdir)); - log_printf(op, TRUE, NULL, " installer prefix : %s", - STRSTR(op->installer_prefix)); - log_printf(op, TRUE, NULL, " doc install prefix : %s", - STRSTR(op->documentation_prefix)); - log_printf(op, TRUE, NULL, " kernel name : %s", - STRSTR(op->kernel_name)); - log_printf(op, TRUE, NULL, " kernel include path : %s", - STRSTR(op->kernel_include_path)); - log_printf(op, TRUE, NULL, " kernel source path : %s", - STRSTR(op->kernel_source_path)); - log_printf(op, TRUE, NULL, " kernel output path : %s", - STRSTR(op->kernel_output_path)); - log_printf(op, TRUE, NULL, " kernel install path : %s", - STRSTR(op->kernel_module_installation_path)); - log_printf(op, TRUE, NULL, " precompiled kernel interfaces path : %s", - STRSTR(op->precompiled_kernel_interfaces_path)); - log_printf(op, TRUE, NULL, " precompiled kernel interfaces url : %s", - STRSTR(op->precompiled_kernel_interfaces_url)); - log_printf(op, TRUE, NULL, " proc mount point : %s", - STRSTR(op->proc_mount_point)); - log_printf(op, TRUE, NULL, " ui : %s", - STRSTR(op->ui_str)); - log_printf(op, TRUE, NULL, " tmpdir : %s", - STRSTR(op->tmpdir)); - log_printf(op, TRUE, NULL, " ftp mirror : %s", - STRSTR(op->ftp_site)); - log_printf(op, TRUE, NULL, " RPM file list : %s", - STRSTR(op->rpm_file_list)); - log_printf(op, TRUE, NULL, " selinux chcon type : %s", - STRSTR(op->selinux_chcon_type)); - + log_printf(op, TRUE, NULL, "nvidia-installer command line:"); + for (i = 0; i < argc; i++) { + log_printf(op, TRUE, " ", "%s", argv[i]); + } log_printf(op, TRUE, NULL, ""); @@ -235,23 +124,30 @@ void log_init(Options *op) * option is not set, then nothing is done here. */ -#define LOG_WIDTH 79 - void log_printf(Options *op, const int wb, const char *prefix, const char *fmt, ...) { char *buf; - int i; - TextRows *t; + int append_newline = TRUE; if (!op->logging) return; NV_VSNPRINTF(buf, fmt); - t = nv_format_text_rows(prefix, buf, LOG_WIDTH, wb); - - for (i = 0; i < t->n; i++) fprintf(log_file_stream, "%s\n", t->t[i]); - - nv_free_text_rows(t); + + /* + * do not append a newline to the end of the string if the caller + * already did + */ + + if (buf && (buf[strlen(buf) - 1] == '\n')) { + append_newline = FALSE; + } + + if (prefix) { + fprintf(log_file_stream, "%s", prefix); + } + fprintf(log_file_stream, "%s%s", buf, append_newline ? "\n" : ""); + nvfree(buf); /* flush, just to be safe */ @@ -35,6 +35,8 @@ #include "nvidia-installer.h" #include "command-list.h" +#define ARRAY_LEN(_arr) (sizeof(_arr) / sizeof(_arr[0])) + /* * NV_VSNPRINTF() - takes a fmt string, and uses vsnprintf to build * the resulting string whic it assigns to buf. The caller of this diff --git a/nvidia-installer.c b/nvidia-installer.c index fa60223..b4826fb 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -432,7 +432,7 @@ int main(int argc, char *argv[]) /* init the log file */ - log_init(op); + log_init(op, argc, argv); /* chdir() to the directory containing the binary */ diff --git a/nvidia-installer.h b/nvidia-installer.h index 05e6276..4d6b004 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -516,7 +516,7 @@ typedef struct { /* prototypes of functions used throughout the installer */ -void log_init(Options *op); +void log_init(Options *op, int argc, char * const argv[]); void log_printf(Options *op, const int wb, const char *prefix, const char *fmt, ...); diff --git a/stream-ui.c b/stream-ui.c index 1df9d23..b8b4f0d 100644 --- a/stream-ui.c +++ b/stream-ui.c @@ -390,8 +390,8 @@ int stream_yes_no(Options *op, const int def, const char *msg) format(stdout, NULL, ""); format(stdout, NULL, msg); - if (def) fprintf(stdout, " [default: Yes]: "); - else fprintf(stdout, " [default: No]: "); + if (def) fprintf(stdout, " [default: (Y)es]: "); + else fprintf(stdout, " [default: (N)o]: "); fflush(stdout); buf = fget_next_line(stdin, &eof); diff --git a/user-interface.c b/user-interface.c index a8d3042..ece6f9f 100644 --- a/user-interface.c +++ b/user-interface.c @@ -69,6 +69,7 @@ extern const int ncurses_ui_array_size; /* struct describing the ui data */ typedef struct { + char *name; char *descr; char *filename; const char *data_array; @@ -93,18 +94,31 @@ int ui_init(Options *op) int i; user_interface_attribute_t ui_list[] = { /* { "nvidia-installer GTK+ user interface", NULL, NULL, 0 }, */ - { "nvidia-installer ncurses user interface", NULL, + { "ncurses", "nvidia-installer ncurses user interface", NULL, ncurses_ui_array, ncurses_ui_array_size }, - { NULL, NULL, NULL, 0 } + { "none", NULL, NULL, NULL, 0 } }; /* dlopen() the appropriate ui shared lib */ __ui = NULL; - - i = 0; - if (((op->ui_str) && (strcmp(op->ui_str, "none") == 0)) || (op->silent)) { + if (op->ui_str) { + for (i = 0; i < ARRAY_LEN(ui_list); i++) { + if (strcmp(op->ui_str, ui_list[i].name) == 0) { + break; + } + } + + if (i == ARRAY_LEN(ui_list)) { + log_printf(op, TRUE, NULL, "Invalid \"ui\" option: %s", op->ui_str); + i = 0; + } + } else { + i = 0; + } + + if (op->silent) { i = 1; } @@ -1 +1 @@ -NVIDIA_VERSION = 285.05.09 +NVIDIA_VERSION = 290.03 |