diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2014-09-30 10:39:05 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2014-09-30 10:39:05 -0700 |
commit | 5181582f787984e36fd822e3959c84cf6d759d6c (patch) | |
tree | f72f188a946d7d5efccda74d3205a3063f5eebd2 | |
parent | 7746b5583acd4d9adf6b7590b6488480e15ac58f (diff) |
340.46340.46
-rw-r--r-- | backup.c | 21 | ||||
-rw-r--r-- | command-list.c | 4 | ||||
-rw-r--r-- | files.c | 5 | ||||
-rw-r--r-- | install-from-cwd.c | 39 | ||||
-rw-r--r-- | misc.c | 65 | ||||
-rw-r--r-- | misc.h | 2 | ||||
-rw-r--r-- | nvidia-installer.h | 1 | ||||
-rw-r--r-- | version.mk | 2 |
8 files changed, 86 insertions, 53 deletions
@@ -1376,18 +1376,15 @@ int uninstall_existing_driver(Options *op, const int interactive) } if (interactive && op->uninstall) { - ret = ui_yes_no(op, FALSE, - "If you plan to no longer use the NVIDIA driver, you " - "should make sure that no X screens are configured to " - "use the NVIDIA X driver in your X configuration file. " - "If you used nvidia-xconfig to configure X, it may have " - "created a backup of your original configuration. Would " - "you like to run `nvidia-xconfig --restore-original-" - "backup` to attempt restoration of the original X " - "configuration file?"); - if (ret) { - run_nvidia_xconfig(op, TRUE); - } + const char *msg = "If you plan to no longer use the NVIDIA driver, you " + "should make sure that no X screens are configured to " + "use the NVIDIA X driver in your X configuration file. " + "If you used nvidia-xconfig to configure X, it may have " + "created a backup of your original configuration. Would " + "you like to run `nvidia-xconfig --restore-original-" + "backup` to attempt restoration of the original X " + "configuration file?"; + run_nvidia_xconfig(op, TRUE, msg, FALSE); } ret = do_uninstall(op, version); diff --git a/command-list.c b/command-list.c index 1ff75e7..913d2dd 100644 --- a/command-list.c +++ b/command-list.c @@ -706,6 +706,10 @@ static void find_conflicting_xfree86_libraries_fullpath(Options *op, char *path, FileList *l) { + if (!op->x_files_packaged) { + /* If X files were not packaged, there can be no conflict. */ + return; + } if (!op->no_opengl_files) { find_conflicting_files(op, path, __xfree86_opengl_libs, l, NULL); } @@ -850,8 +850,9 @@ int get_prefixes (Options *op) * after the default prefixes/paths are assigned. */ - get_x_library_and_module_paths(op); - + if (op->x_files_packaged) { + get_x_library_and_module_paths(op); + } if (op->expert) { ret = ui_get_input(op, op->x_library_path, diff --git a/install-from-cwd.c b/install-from-cwd.c index c107014..ae1c5bc 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -76,12 +76,11 @@ int install_from_cwd(Options *op) { Package *p; CommandList *c; - const char *msg; int ret; int ran_pre_install_hook = FALSE; HookScriptStatus res; - static const char edit_your_xf86config[] = + static const char* edit_your_xf86config = "Please update your XF86Config or xorg.conf file as " "appropriate; see the file /usr/share/doc/" "NVIDIA_GLX-1.0/README.txt for details."; @@ -93,6 +92,10 @@ int install_from_cwd(Options *op) if ((p = parse_manifest(op)) == NULL) goto failed; + if (!op->x_files_packaged) { + edit_your_xf86config = ""; + } + ui_set_title(op, "%s (%s)", p->description, p->version); /* @@ -321,28 +324,22 @@ int install_from_cwd(Options *op) /* ask the user if they would like to run nvidia-xconfig */ - ret = ui_yes_no(op, op->run_nvidia_xconfig, - "Would you like to run the nvidia-xconfig utility " - "to automatically update your X configuration file " - "so that the NVIDIA X driver will be used when you " - "restart X? Any pre-existing X configuration " - "file will be backed up."); + const char *msg = "Would you like to run the nvidia-xconfig utility " + "to automatically update your X configuration file " + "so that the NVIDIA X driver will be used when you " + "restart X? Any pre-existing X configuration " + "file will be backed up."; - if (ret) { - ret = run_nvidia_xconfig(op, FALSE); - } + ret = run_nvidia_xconfig(op, FALSE, msg, op->run_nvidia_xconfig); if (ret) { ui_message(op, "Your X configuration file has been successfully " "updated. Installation of the %s (version: %s) is now " "complete.", p->description, p->version); } else { - - msg = edit_your_xf86config; - ui_message(op, "Installation of the %s (version: %s) is now " "complete. %s", p->description, - p->version, msg); + p->version, edit_your_xf86config); } } @@ -841,10 +838,16 @@ static Package *parse_manifest (Options *op) goto invalid_manifest_file; } - /* if any UVM files have been packaged, set uvm_files_packaged. */ + /* Track whether certain file types were packaged */ - if (entry.type == FILE_TYPE_UVM_MODULE_SRC) { - op->uvm_files_packaged = TRUE; + switch (entry.type) { + case FILE_TYPE_UVM_MODULE_SRC: + op->uvm_files_packaged = TRUE; + break; + case FILE_TYPE_XMODULE_SHARED_LIB: + op->x_files_packaged = TRUE; + break; + default: break; } /* set opengl_files_packaged if any OpenGL files were packaged */ @@ -2491,31 +2491,58 @@ int check_selinux(Options *op) /* * run_nvidia_xconfig() - run the `nvidia-xconfig` utility. Without * any options, this will just make sure the X config file uses the - * NVIDIA driver by default. The restore parameter controls whether - * the --restore-original-backup option is added, which attempts to - * restore the original backed up X config file. + * NVIDIA driver by default. + * + * Parameters: + * + * restore: controls whether the --restore-original-backup option is added, + * which attempts to restore the original backed up X config file. + * question: if this is non-NULL, the user will be asked 'question' as a + * yes or no question, to determine whether to run nvidia-xconfig. + * answer: the default answer to 'question'. + * + * Returns TRUE if nvidia-xconfig ran successfully; returns FALSE if + * nvidia-xconfig ran unsuccessfully, or did not run at all. */ -int run_nvidia_xconfig(Options *op, int restore) +int run_nvidia_xconfig(Options *op, int restore, const char *question, + int default_answer) { - int ret, bRet = TRUE; - char *data = NULL, *cmd, *args; + int ret = FALSE; + char *nvidia_xconfig; - args = restore ? " --restore-original-backup" : ""; - - cmd = nvstrcat(find_system_util("nvidia-xconfig"), args, NULL); - - ret = run_command(op, cmd, &data, FALSE, 0, TRUE); - - if (ret != 0) { - ui_error(op, "Failed to run `%s`:\n%s", cmd, data); - bRet = FALSE; + nvidia_xconfig = find_system_util("nvidia-xconfig"); + + if (nvidia_xconfig == NULL) { + /* nvidia-xconfig not found: don't run it or ask any questions */ + goto done; } - - nvfree(cmd); - nvfree(data); - return bRet; + ret = question ? ui_yes_no(op, default_answer, "%s", question) : TRUE; + + if (ret) { + int cmd_ret; + char *data, *cmd, *args; + + args = restore ? " --restore-original-backup" : ""; + + cmd = nvstrcat(nvidia_xconfig, args, NULL); + + cmd_ret = run_command(op, cmd, &data, FALSE, 0, TRUE); + + if (cmd_ret != 0) { + ui_error(op, "Failed to run `%s`:\n%s", cmd, data); + ret = FALSE; + } + + nvfree(cmd); + nvfree(data); + } + +done: + nvfree(nvidia_xconfig); + + return ret; } /* run_nvidia_xconfig() */ @@ -83,7 +83,7 @@ Distribution get_distribution(Options *op); int check_for_running_x(Options *op); int check_for_modular_xorg(Options *op); int check_for_nvidia_graphics_devices(Options *op, Package *p); -int run_nvidia_xconfig(Options *op, int restore); +int run_nvidia_xconfig(Options *op, int restore, const char *question, int answer); HookScriptStatus run_distro_hook(Options *op, const char *hook); int check_for_alternate_install(Options *op); int check_for_nouveau(Options *op); diff --git a/nvidia-installer.h b/nvidia-installer.h index e947c87..2a89639 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -167,6 +167,7 @@ typedef struct __options { int num_kernel_modules; int install_uvm; int uvm_files_packaged; + int x_files_packaged; NVOptionalBool install_vdpau_wrapper; @@ -1 +1 @@ -NVIDIA_VERSION = 340.32 +NVIDIA_VERSION = 340.46 |