This commit is contained in:
Liam Middlebrook
2019-01-30 10:33:13 -08:00
parent 3325b7fdab
commit 97705a4fff
10 changed files with 71 additions and 50 deletions

View File

@@ -115,7 +115,8 @@ static void free_backup_info(BackupInfo *b);
static int check_backup_log_entries(Options *op, BackupInfo *b);
static int do_uninstall(Options *op, const char *version);
static int do_uninstall(Options *op, const char *version,
const int skip_depmod);
static int sanity_check_backup_log_entries(Options *op, BackupInfo *b);
@@ -627,7 +628,8 @@ static int rmdir_recursive(Options *op)
* driver, by parsing the BACKUP_LOG file.
*/
static int do_uninstall(Options *op, const char *version)
static int do_uninstall(Options *op, const char *version,
const int skip_depmod)
{
BackupLogEntry *e;
BackupInfo *b;
@@ -836,14 +838,15 @@ static int do_uninstall(Options *op, const char *version)
/* Update modules.dep and the ldconfig(8) cache to remove entries for
* any DSOs and kernel modules that we just uninstalled. */
char *cmd;
int status;
int status = 0;
ui_log(op, "Running depmod and ldconfig:");
ui_log(op, "Running %sldconfig:", op->skip_depmod ? "" : "depmod and ");
cmd = nvstrcat(op->utils[DEPMOD], " -a ", op->kernel_name, NULL);
status = run_command(op, cmd, NULL, FALSE, 0, FALSE);
nvfree(cmd);
if (!op->skip_depmod) {
char *cmd = nvstrcat(op->utils[DEPMOD], " -a ", op->kernel_name, NULL);
status |= run_command(op, cmd, NULL, FALSE, 0, FALSE);
nvfree(cmd);
}
status |= run_command(op, op->utils[LDCONFIG], NULL, FALSE, 0, FALSE);
@@ -1367,7 +1370,8 @@ int check_for_existing_driver(Options *op, Package *p)
* stop (so it always returns TRUE).
*/
int uninstall_existing_driver(Options *op, const int interactive)
int uninstall_existing_driver(Options *op, const int interactive,
const int skip_depmod)
{
int ret;
char *descr = NULL;
@@ -1393,7 +1397,7 @@ int uninstall_existing_driver(Options *op, const int interactive)
run_nvidia_xconfig(op, TRUE, msg, FALSE);
}
ret = do_uninstall(op, version);
ret = do_uninstall(op, version, skip_depmod);
if (ret) {
if (interactive) {
@@ -1414,6 +1418,23 @@ int uninstall_existing_driver(Options *op, const int interactive)
} /* uninstall_existing_driver() */
/*
* Determine if the nvidia-uninstall executable at the path in 'uninstaller'
* supports the '--skip-depmod' option. To do this, we simply examine the help
* text for the presence of the option.
*/
static int check_skip_depmod_support(Options *op, const char *uninstaller)
{
char *cmd = nvstrcat(uninstaller, " -A | ", op->utils[GREP],
" -q '^ \\+--skip-depmod$'", NULL);
int ret = run_command(op, cmd, NULL, FALSE, 0, FALSE);
nvfree(cmd);
/* exit status is 0 in case of success, so invert here */
return !ret;
}
/*
@@ -1424,14 +1445,27 @@ int run_existing_uninstaller(Options *op)
{
char *uninstaller = find_system_util("nvidia-uninstall");
/*
* This function is run as part of installation. If we're about to install
* kernel modules and run depmod afterwards, we don't need to run depmod
* as part of uninstallation.
*/
int skip_depmod = !op->no_kernel_module;
if (uninstaller) {
/* Run the uninstaller non-interactively, and explicitly log to the
* uninstall log location: older installers may not do so implicitly. */
char *uninstall_cmd = nvstrcat(uninstaller, " -s --log-file-name="
DEFAULT_UNINSTALL_LOG_FILE_NAME, NULL);
char *uninstall_cmd = NULL;
char *data = NULL;
int ret;
skip_depmod = skip_depmod && check_skip_depmod_support(op, uninstaller);
/* Run the uninstaller non-interactively, and explicitly log to the
* uninstall log location: older installers may not do so implicitly. */
uninstall_cmd = nvstrcat(uninstaller, " -s --log-file-name="
DEFAULT_UNINSTALL_LOG_FILE_NAME,
skip_depmod ? " --skip-depmod" : NULL,
NULL);
ui_log(op, "Uninstalling the previous installation with %s.",
uninstaller);
@@ -1442,6 +1476,7 @@ int run_existing_uninstaller(Options *op)
/* if nvidia-uninstall succeeded, return early; otherwise, fall back to
* uninstalling via the backup log file. */
if (ret == 0) {
nvfree(uninstaller);
nvfree(data);
return TRUE;
} else {
@@ -1456,7 +1491,8 @@ int run_existing_uninstaller(Options *op)
nvfree(uninstaller);
}
return uninstall_existing_driver(op, FALSE);
return uninstall_existing_driver(op, FALSE /* interactive */,
skip_depmod);
}

View File

@@ -32,7 +32,7 @@ int do_backup (Options*, const char*);
int log_install_file (Options*, const char*);
int log_create_symlink (Options*, const char*, const char*);
int check_for_existing_driver (Options*, Package*);
int uninstall_existing_driver (Options*, const int);
int uninstall_existing_driver (Options*, const int, const int);
int run_existing_uninstaller (Options*);
int report_driver_information (Options*);

View File

@@ -365,19 +365,6 @@ CommandList *build_command_list(Options *op, Package *p)
for (i = 0; i < p->num_entries; i++) {
if (p->entries[i].caps.is_symlink) {
/* if it's a NEWSYM and the file already exists, don't add a command
* for it */
if (p->entries[i].type == FILE_TYPE_XMODULE_NEWSYM) {
struct stat buf;
if(!stat(p->entries[i].dst, &buf) || errno != ENOENT) {
ui_expert(op, "Not creating a symlink from %s to %s "
"because a file already exists at that path "
"or the path is inaccessible.",
p->entries[i].dst, p->entries[i].target);
continue;
}
}
add_command(c, SYMLINK_CMD, p->entries[i].dst,
p->entries[i].target);
}
@@ -421,7 +408,7 @@ CommandList *build_command_list(Options *op, Package *p)
* <Nigel.Spowage@energis.com>
*/
if (!op->no_kernel_module) {
if (!op->no_kernel_module && !op->skip_depmod) {
tmp = nvstrcat(op->utils[DEPMOD], " -a ", op->kernel_name, NULL);
add_command(c, RUN_CMD, tmp);
nvfree(tmp);

View File

@@ -605,9 +605,7 @@ int set_destinations(Options *op, Package *p)
case FILE_TYPE_XMODULE_SHARED_LIB:
case FILE_TYPE_GLX_MODULE_SHARED_LIB:
case FILE_TYPE_XMODULE_SYMLINK:
case FILE_TYPE_GLX_MODULE_SYMLINK:
case FILE_TYPE_XMODULE_NEWSYM:
prefix = op->x_module_path;
dir = "";
path = p->entries[i].path;

View File

@@ -97,10 +97,8 @@ static const struct {
{ ENTRY(UTILITY_BIN_SYMLINK, F, F, F, T, F, F, F, T, F, F) },
{ ENTRY(DOT_DESKTOP, F, T, T, F, F, F, T, T, F, F) },
{ ENTRY(XMODULE_SHARED_LIB, F, T, T, F, T, F, F, T, F, F) },
{ ENTRY(XMODULE_SYMLINK, F, F, T, T, F, F, F, T, F, F) },
{ ENTRY(GLX_MODULE_SHARED_LIB, F, T, T, F, T, T, F, T, F, F) },
{ ENTRY(GLX_MODULE_SYMLINK, F, F, T, T, F, T, F, T, F, F) },
{ ENTRY(XMODULE_NEWSYM, F, F, T, T, F, F, F, T, F, F) },
{ ENTRY(VDPAU_LIB, T, T, T, F, T, F, F, T, F, F) },
{ ENTRY(VDPAU_SYMLINK, T, F, T, T, F, F, F, T, F, F) },
{ ENTRY(NVCUVID_LIB, T, T, F, F, T, F, F, T, F, F) },
@@ -217,9 +215,7 @@ void get_installable_file_type_list(
/*
* Add symlink file types to the given file list. This is used when
* building a list of existing files to remove. The NEWSYM type
* requires special handling: while it is a symlink, we do not remove
* it from the filesystem if it already exists.
* building a list of existing files to remove.
*/
void add_symlinks_to_file_type_list(PackageEntryFileTypeList *file_type_list)
{
@@ -233,10 +229,6 @@ void add_symlinks_to_file_type_list(PackageEntryFileTypeList *file_type_list)
continue;
}
if (type == FILE_TYPE_XMODULE_NEWSYM) {
continue;
}
file_type_list->types[type] = 1;
}
}

6
misc.c
View File

@@ -1187,11 +1187,7 @@ void check_installed_files_from_package(Options *op, Package *p)
percent = (float) i / (float) p->num_entries;
ui_status_update(op, percent, "%s", p->entries[i].dst);
if (p->entries[i].caps.is_symlink &&
/* Don't bother checking FILE_TYPE_NEWSYMs because we may not have
* installed them. */
p->entries[i].type != FILE_TYPE_XMODULE_NEWSYM) {
if (p->entries[i].caps.is_symlink) {
if (!check_symlink(op, p->entries[i].target,
p->entries[i].dst,
p->description)) {

View File

@@ -145,6 +145,7 @@ static Options *load_default_options(void)
op->install_libglx_indirect = NV_OPTIONAL_BOOL_DEFAULT;
op->install_libglvnd_libraries = NV_OPTIONAL_BOOL_DEFAULT;
op->external_platform_json_path = DEFAULT_EGL_EXTERNAL_PLATFORM_JSON_PATH;
op->skip_depmod = FALSE;
return op;
@@ -475,6 +476,9 @@ static void parse_commandline(int argc, char *argv[], Options *op)
goto fail;
}
break;
case SKIP_DEPMOD_OPTION:
op->skip_depmod = TRUE;
break;
default:
goto fail;
}
@@ -622,7 +626,8 @@ int main(int argc, char *argv[])
/* uninstall */
else if (op->uninstall) {
ret = uninstall_existing_driver(op, TRUE);
ret = uninstall_existing_driver(op, TRUE /* interactive */,
op->skip_depmod);
}
/* add this kernel */

View File

@@ -111,8 +111,6 @@ typedef enum {
FILE_TYPE_DOT_DESKTOP,
FILE_TYPE_UTILITY_LIB_SYMLINK,
FILE_TYPE_XMODULE_SHARED_LIB,
FILE_TYPE_XMODULE_SYMLINK,
FILE_TYPE_XMODULE_NEWSYM, /* Create a symlink if the file doesn't exist */
FILE_TYPE_MANPAGE,
FILE_TYPE_EXPLICIT_PATH,
FILE_TYPE_CUDA_LIB,
@@ -214,6 +212,7 @@ typedef struct __options {
int skip_module_load;
int glvnd_glx_client;
int glvnd_egl_client;
int skip_depmod;
NVOptionalBool install_libglx_indirect;
NVOptionalBool install_libglvnd_libraries;

View File

@@ -105,6 +105,7 @@ enum {
GLVND_EGL_CLIENT_OPTION,
EGL_EXTERNAL_PLATFORM_CONFIG_FILE_PATH_OPTION,
OVERRIDE_FILE_TYPE_DESTINATION_OPTION,
SKIP_DEPMOD_OPTION,
};
static const NVGetoptOption __options[] = {
@@ -652,6 +653,13 @@ static const NVGetoptOption __options[] = {
"destination of the specified file type."
},
{ "skip-depmod",
SKIP_DEPMOD_OPTION, NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL,
"Don't run the depmod(1) utility after modifying kernel modules. This "
"should only be used in cases where depmod(1) will be run separately after "
"running nvidia-installer."
},
/* Orphaned options: These options were in the long_options table in
* nvidia-installer.c but not in the help. */
{ "debug", 'd', 0, NULL,NULL },

View File

@@ -1 +1 @@
NVIDIA_VERSION = 415.27
NVIDIA_VERSION = 418.30