From da0b9b2b01971f73d0dc072f538ef43aac0ee49d Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 13 Feb 2008 10:20:38 -0800 Subject: 1.0-9626 --- DRIVER_VERSION | 2 +- backup.c | 14 +++++++------- files.c | 27 +++++++++++++-------------- install-from-cwd.c | 10 ++++------ log.c | 2 ++ misc.c | 39 +++++++++++++++++++++++++-------------- nvidia-installer.c | 3 +++ nvidia-installer.h | 11 +++++------ option_table.h | 12 +++++++++--- 9 files changed, 69 insertions(+), 51 deletions(-) diff --git a/DRIVER_VERSION b/DRIVER_VERSION index 33dcb97..fef6dba 100644 --- a/DRIVER_VERSION +++ b/DRIVER_VERSION @@ -1 +1 @@ -1.0-8774 +1.0-9626 diff --git a/backup.c b/backup.c index b061852..dbb168c 100644 --- a/backup.c +++ b/backup.c @@ -618,14 +618,14 @@ static int do_uninstall(Options *op) if (!nvrename(op, tmpstr, e->filename)) { ui_warn(op, "Unable to restore file '%s'.", e->filename); } else { - if (chmod(e->filename, e->mode) == -1) { - ui_warn(op, "Unable to restore permissions %04o for " - "file '%s'.", e->mode, e->filename); + if (chown(e->filename, e->uid, e->gid)) { + ui_warn(op, "Unable to restore owner (%d) and group " + "(%d) for file '%s' (%s).", + e->uid, e->gid, e->filename, strerror(errno)); } else { - if (chown(e->filename, e->uid, e->gid)) { - ui_warn(op, "Unable to restore owner (%d) and group " - "(%d) for file '%s' (%s).", - e->uid, e->gid, e->filename, strerror(errno)); + if (chmod(e->filename, e->mode) == -1) { + ui_warn(op, "Unable to restore permissions %04o for " + "file '%s'.", e->mode, e->filename); } } } diff --git a/files.c b/files.c index cb8a090..7ad0493 100644 --- a/files.c +++ b/files.c @@ -522,7 +522,6 @@ int set_destinations(Options *op, Package *p) break; case FILE_TYPE_XMODULE_SHARED_LIB: - case FILE_TYPE_XMODULE_STATIC_LIB: case FILE_TYPE_XMODULE_SYMLINK: prefix = op->x_module_path; dir = ""; @@ -1879,7 +1878,7 @@ int set_security_context(Options *op, const char *filename) /* * get_default_prefixes_and_paths() - assign the default prefixes and - * paths depending on the architecture, distribution and the Xorg + * paths depending on the architecture, distribution and the X.Org * version installed on the system. */ @@ -1999,11 +1998,11 @@ static int get_x_library_path(Options *op) if (!op->utils[PKG_CONFIG]) { if (op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but nvidia-installer could not find the " "`pkg-config` utility required to determine the " "correct X library installation path. Please " - "install the `pkg-config` utility and the Xorg " + "install the `pkg-config` utility and the X.Org " "SDK/development package for your distribution."); } } else { @@ -2017,21 +2016,21 @@ static int get_x_library_path(Options *op) if ((ret != 0) || (dir == NULL)) { if (op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but nvidia-installer was unable to " "determine the correct X library " "installation path with the `pkg-config` " - "utility. Please install the Xorg SDK/" + "utility. Please install the X.Org SDK/" "development package for your distribution."); } } else { if (!directory_exists(op, dir) && op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but the X library installation " "path reported by `pkg-config " "--variable=libdir xorg-server` does " - "not exist. Please check your Xorg installation."); + "not exist. Please check your X.Org installation."); } else { op->x_library_path = dir; return TRUE; @@ -2081,11 +2080,11 @@ static int get_x_module_path(Options *op) if (!op->utils[PKG_CONFIG]) { if (op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but nvidia-installer could not find the " "`pkg-config` utility required to determine the " "correct X module installation path. Please " - "install the `pkg-config` utility and the Xorg " + "install the `pkg-config` utility and the X.Org " "SDK/development package for your distribution."); } } else { @@ -2100,21 +2099,21 @@ static int get_x_module_path(Options *op) if ((ret != 0) || (dir == NULL)) { if (op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but nvidia-installer was unable to " "determine the correct X module " "installation path with the `pkg-config` " - "utility. Please install the Xorg SDK/" + "utility. Please install the X.Org SDK/" "development package for your distribution."); } } else { if (!directory_exists(op, dir) && op->modular_xorg) { - ui_warn(op, "You appear to be using a modular Xorg " + ui_warn(op, "You appear to be using a modular X.Org " "release, but the X module installation " "path reported by `pkg-config " "--variable=moduledir xorg-server` does " - "not exist. Please check your Xorg installation."); + "not exist. Please check your X.Org installation."); } else { op->x_module_path = dir; return TRUE; diff --git a/install-from-cwd.c b/install-from-cwd.c index fc62058..10ff483 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -106,14 +106,14 @@ int install_from_cwd(Options *op) check_for_nvidia_graphics_devices(op, p); - /* make sure the kernel module is unloaded */ - - if (!check_for_unloaded_kernel_module(op, p)) goto failed; - /* check that we are not running any X server */ if (!check_for_running_x(op)) goto failed; + /* make sure the kernel module is unloaded */ + + if (!check_for_unloaded_kernel_module(op, p)) goto failed; + /* ask the user to accept the license */ if (!get_license_acceptance(op)) return FALSE; @@ -651,8 +651,6 @@ static Package *parse_manifest (Options *op) p->entries[n].flags |= FILE_TYPE_UTILITY_BINARY; else if (strcmp(flag, "DOT_DESKTOP") == 0) p->entries[n].flags |= FILE_TYPE_DOT_DESKTOP; - else if (strcmp(flag, "XMODULE_STATIC_LIB") == 0) - p->entries[n].flags |= FILE_TYPE_XMODULE_STATIC_LIB; else if (strcmp(flag, "XMODULE_SHARED_LIB") == 0) p->entries[n].flags |= FILE_TYPE_XMODULE_SHARED_LIB; else if (strcmp(flag, "XMODULE_SYMLINK") == 0) diff --git a/log.c b/log.c index 0f75896..c268c46 100644 --- a/log.c +++ b/log.c @@ -147,6 +147,8 @@ void log_init(Options *op) 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, " force tls : %s", TLSSTR(op->which_tls)); #if defined(NV_X86_64) diff --git a/misc.c b/misc.c index 5fbf215..106ef26 100644 --- a/misc.c +++ b/misc.c @@ -1985,15 +1985,17 @@ done: * non-NVIDIA driver) can cause stability problems, so check that * there is no X server running. To do this, scan for any * /tmp/.X[n]-lock files, where [n] is the number of the X Display - * (we'll just check for 0-7). If any X server is running, print an - * error message and return FALSE. If no X server is running, return - * TRUE. + * (we'll just check for 0-7). Get the pid contained in this X lock file, + * this is the pid of the running X server. If any X server is running, + * print an error message and return FALSE. If no X server is running, + * return TRUE. */ int check_for_running_x(Options *op) { - char path[14]; - int i; + char path[14], *buf; + char procpath[17]; /* contains /proc/%d, accounts for 32-bit values of pid */ + int i, pid; /* * If we are installing for a non-running kernel *and* we are only @@ -2008,15 +2010,24 @@ int check_for_running_x(Options *op) for (i = 0; i < 8; i++) { snprintf(path, 14, "/tmp/.X%1d-lock", i); - if (access(path, R_OK) == 0) { - ui_log(op, "The file '%s' exists... an X server appears to be " - "running", path); - ui_error(op, "You appear to be running an X server; please exit " - "X before installing. For further details, please see " - "the section INSTALLING THE NVIDIA DRIVER in the README " - "available on the Linux driver download page at " - "www.nvidia.com."); - return FALSE; + if (read_text_file(path, &buf) == TRUE) { + sscanf(buf, "%d", &pid); + nvfree(buf); + snprintf(procpath, 17, "/proc/%d", pid); + if (access(procpath, F_OK) == 0) { + ui_log(op, "The file '%s' exists and appears to contain the " + "process ID '%d' of a runnning X server.", path, pid); + if (op->no_x_check) { + ui_log(op, "Continuing per the '--no-x-check' option."); + } else { + ui_error(op, "You appear to be running an X server; please " + "exit X before installing. For further details, " + "please see the section INSTALLING THE NVIDIA " + "DRIVER in the README available on the Linux driver " + "download page at www.nvidia.com."); + return FALSE; + } + } } } diff --git a/nvidia-installer.c b/nvidia-installer.c index 1458242..af787fc 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -421,6 +421,9 @@ Options *parse_commandline(int argc, char *argv[]) op->no_kernel_module = TRUE; op->kernel_module_only = FALSE; /* conflicts */ break; + case NO_X_CHECK_OPTION: + op->no_x_check = TRUE; + break; default: fmterr(""); diff --git a/nvidia-installer.h b/nvidia-installer.h index 350e641..d11a17b 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -134,6 +134,7 @@ typedef struct __options { int selinux_option; int selinux_enabled; int sigwinch_workaround; + int no_x_check; char *opengl_prefix; char *opengl_libdir; @@ -298,10 +299,9 @@ typedef struct { #define FILE_TYPE_UTILITY_LIB 0x00008000 #define FILE_TYPE_DOT_DESKTOP 0x00010000 #define FILE_TYPE_UTILITY_SYMLINK 0x00020000 -#define FILE_TYPE_XMODULE_STATIC_LIB 0x00040000 -#define FILE_TYPE_XMODULE_SHARED_LIB 0x00080000 -#define FILE_TYPE_XMODULE_SYMLINK 0x00100000 -#define FILE_TYPE_MANPAGE 0x00200000 +#define FILE_TYPE_XMODULE_SHARED_LIB 0x00040000 +#define FILE_TYPE_XMODULE_SYMLINK 0x00080000 +#define FILE_TYPE_MANPAGE 0x00100000 /* file class: this is used to distinguish OpenGL libraries */ @@ -315,8 +315,7 @@ typedef struct { #define FILE_TYPE_XLIB_LIB (FILE_TYPE_XLIB_STATIC_LIB | \ FILE_TYPE_XLIB_SHARED_LIB) -#define FILE_TYPE_XMODULE_LIB (FILE_TYPE_XMODULE_STATIC_LIB | \ - FILE_TYPE_XMODULE_SHARED_LIB) +#define FILE_TYPE_XMODULE_LIB (FILE_TYPE_XMODULE_SHARED_LIB) #define FILE_TYPE_INSTALLABLE_FILE (FILE_TYPE_OPENGL_LIB | \ FILE_TYPE_XLIB_LIB | \ diff --git a/option_table.h b/option_table.h index 684239b..5a25039 100644 --- a/option_table.h +++ b/option_table.h @@ -49,7 +49,8 @@ enum { X_MODULE_PATH_OPTION, DOCUMENTATION_PREFIX_OPTION, X_LIBRARY_PATH_OPTION, - NO_KERNEL_MODULE_OPTION + NO_KERNEL_MODULE_OPTION, + NO_X_CHECK_OPTION }; static const NVOption __options[] = { @@ -116,7 +117,7 @@ static const NVOption __options[] = { { "x-prefix", X_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, "The prefix under which the X components of the " "NVIDIA driver will be installed; the default is '" DEFAULT_X_PREFIX - "' unless nvidia-installer detects that Xorg >= 7.0 is installed, " + "' unless nvidia-installer detects that X.Org >= 7.0 is installed, " "in which case the default is '" XORG7_DEFAULT_X_PREFIX "'. Only " "under rare circumstances should this option be used." }, @@ -129,7 +130,7 @@ static const NVOption __options[] = { "returns a directory that exists, then that is the default; otherwise, " "this value defaults to the X library path (see the '--x-library-path' " "option) plus '" DEFAULT_X_MODULEDIR "' or '" XORG7_DEFAULT_X_MODULEDIR - "' if nvidia-installer detects that Xorg >= 7.0 is installed." }, + "' if nvidia-installer detects that X.Org >= 7.0 is installed." }, { "x-library-path", X_LIBRARY_PATH_OPTION, NVOPT_HAS_ARGUMENT, "The path under which the NVIDIA X libraries will be installed. " @@ -365,6 +366,11 @@ static const NVOption __options[] = { "must be careful to ensure that a NVIDIA kernel module matching " "this driver version is installed seperately." }, + { "no-x-check", NO_X_CHECK_OPTION, 0, + "Do not abort the installation if nvidia-installer detects that " + "an X server is running. Only under very rare circumstances should " + "this option be used." }, + { "precompiled-kernel-interfaces-path", PRECOMPILED_KERNEL_INTERFACES_PATH_OPTION, NVOPT_HAS_ARGUMENT, "Before searching for a precompiled kernel interface in the " -- cgit v1.2.3