diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2014-12-04 14:34:13 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2014-12-04 14:34:13 -0800 |
commit | 5f64de0fc3ed61f016d872f4e4b5ec22885adb82 (patch) | |
tree | 4dc8b5e71dcd0a68c90b0b621a75e67d9dbdd59c | |
parent | 2574fdfc9c20e9372ffda4f8601a0322bd408c4e (diff) |
-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 | 56 | ||||
-rw-r--r-- | misc.h | 2 | ||||
-rw-r--r-- | nvidia-installer.h | 1 | ||||
-rw-r--r-- | version.mk | 2 |
8 files changed, 77 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 523cb57..39d566a 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,40 +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 = NULL, *args, *nvidia_xconfig; + int ret = FALSE; + char *nvidia_xconfig; 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; } - args = restore ? " --restore-original-backup" : ""; - - cmd = nvstrcat(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; + 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(cmd); - nvfree(data); nvfree(nvidia_xconfig); - return bRet; + 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 fdb1ddf..a61b630 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 = 343.22 +NVIDIA_VERSION = 343.36 |