diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2018-08-03 15:54:37 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2018-08-03 15:54:37 -0700 |
commit | df6bfdb2cfc687e19fedd0909f63b83ac6812a5c (patch) | |
tree | 1a138cbedaa4c983b4b9fc57b9ffe640c4fc0de4 | |
parent | 920961c03710b189067193adae7abcbb9ab945da (diff) |
396.51396.51
-rw-r--r-- | files.c | 9 | ||||
-rw-r--r-- | nvidia-installer.c | 34 | ||||
-rw-r--r-- | nvidia-installer.h | 138 | ||||
-rw-r--r-- | option_table.h | 13 | ||||
-rw-r--r-- | version.mk | 2 |
5 files changed, 127 insertions, 69 deletions
@@ -612,6 +612,15 @@ int set_destinations(Options *op, Package *p) } for (i = 0; i < p->num_entries; i++) { + /* If a file type's destination was overridden, use the override */ + if (op->file_type_destination_overrides[p->entries[i].type] != NULL) { + p->entries[i].dst = nvstrcat( + op->file_type_destination_overrides[p->entries[i].type], "/", + p->entries[i].name, NULL); + collapse_multiple_slashes(p->entries[i].dst); + + continue; + } switch (p->entries[i].type) { diff --git a/nvidia-installer.c b/nvidia-installer.c index 9c01f9b..6d09d2b 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -43,6 +43,7 @@ #include "sanity.h" #include "option_table.h" #include "msg.h" +#include "manifest.h" static void print_version(void); static void print_help(const char* name, int is_uninstall, int advanced); @@ -153,6 +154,34 @@ static Options *load_default_options(void) } /* load_default_options() */ +/* Parse the file type and destination out from the argument to the + * --override-file-type-destination command line option. Return TRUE if + * parsing was successful, or FALSE on a parse error. */ +static int assign_file_type_override(Options *op, char *optarg) +{ + PackageEntryFileCapabilities dummy; + PackageEntryFileType type; + char *split; + + /* Terminate the string at the first ':' to get the file type, and + * advance to the character after the ':' to get the destination. */ + split = strchr(optarg, ':'); + if (split == NULL) { + return FALSE; + } + split[0] = '\0'; + split++; + + type = parse_manifest_file_type(optarg, &dummy); + if (type == FILE_TYPE_NONE) { + return FALSE; + } + + op->file_type_destination_overrides[type] = nvstrdup(split); + + return TRUE; +} + /* * parse_commandline() - Populate the Options structure with @@ -460,6 +489,11 @@ static void parse_commandline(int argc, char *argv[], Options *op) case EGL_EXTERNAL_PLATFORM_CONFIG_FILE_PATH_OPTION: op->external_platform_json_path = strval; break; + case OVERRIDE_FILE_TYPE_DESTINATION_OPTION: + if (!assign_file_type_override(op, strval)) { + goto fail; + } + break; default: goto fail; } diff --git a/nvidia-installer.h b/nvidia-installer.h index 86e119d..73b2c87 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -92,6 +92,74 @@ typedef enum { #define MAX_UTILS MAX_DEVELOP_UTILS +/* + * Types of installed files. Keep in sync with + * manifest.c:packageEntryFileTypeTable[] + */ +typedef enum { + FILE_TYPE_NONE, + FILE_TYPE_KERNEL_MODULE_SRC, + FILE_TYPE_OPENGL_HEADER, + FILE_TYPE_OPENGL_LIB, + FILE_TYPE_DOCUMENTATION, + FILE_TYPE_OPENGL_SYMLINK, + FILE_TYPE_KERNEL_MODULE, + FILE_TYPE_INSTALLER_BINARY, + FILE_TYPE_UTILITY_BINARY, + FILE_TYPE_LIBGL_LA, + FILE_TYPE_TLS_LIB, + FILE_TYPE_TLS_SYMLINK, + FILE_TYPE_UTILITY_LIB, + 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, + FILE_TYPE_OPENCL_LIB, + FILE_TYPE_OPENCL_WRAPPER_LIB, + FILE_TYPE_CUDA_SYMLINK, + FILE_TYPE_OPENCL_LIB_SYMLINK, + FILE_TYPE_OPENCL_WRAPPER_SYMLINK, + FILE_TYPE_VDPAU_LIB, + FILE_TYPE_VDPAU_SYMLINK, + FILE_TYPE_UTILITY_BIN_SYMLINK, + FILE_TYPE_CUDA_ICD, + FILE_TYPE_NVCUVID_LIB, + FILE_TYPE_NVCUVID_LIB_SYMLINK, + FILE_TYPE_GLX_MODULE_SHARED_LIB, + FILE_TYPE_GLX_MODULE_SYMLINK, + FILE_TYPE_ENCODEAPI_LIB, + FILE_TYPE_ENCODEAPI_LIB_SYMLINK, + FILE_TYPE_VGX_LIB, + FILE_TYPE_VGX_LIB_SYMLINK, + FILE_TYPE_GRID_LIB, + FILE_TYPE_GRID_LIB_SYMLINK, + FILE_TYPE_APPLICATION_PROFILE, + FILE_TYPE_NVIDIA_MODPROBE, + FILE_TYPE_NVIDIA_MODPROBE_MANPAGE, + FILE_TYPE_MODULE_SIGNING_KEY, + FILE_TYPE_NVIFR_LIB, + FILE_TYPE_NVIFR_LIB_SYMLINK, + FILE_TYPE_XORG_OUTPUTCLASS_CONFIG, + FILE_TYPE_DKMS_CONF, + FILE_TYPE_GLVND_LIB, + FILE_TYPE_GLVND_SYMLINK, + FILE_TYPE_VULKAN_ICD_JSON, + FILE_TYPE_GLX_CLIENT_LIB, + FILE_TYPE_GLX_CLIENT_SYMLINK, + FILE_TYPE_GLVND_EGL_ICD_JSON, + FILE_TYPE_EGL_CLIENT_LIB, + FILE_TYPE_EGL_CLIENT_SYMLINK, + FILE_TYPE_EGL_EXTERNAL_PLATFORM_JSON, + FILE_TYPE_FLEXERA_LIB, + FILE_TYPE_FLEXERA_LIB_SYMLINK, + FILE_TYPE_ALLOCATOR_JSON, + FILE_TYPE_MAX +} PackageEntryFileType; + typedef uint32_t uint32; typedef uint16_t uint16; @@ -158,6 +226,8 @@ typedef struct __options { NVOptionalBool install_libglvnd_libraries; NVOptionalBool install_compat32_libs; + char *file_type_destination_overrides[FILE_TYPE_MAX]; + char *opengl_prefix; char *opengl_libdir; char *opengl_incdir; @@ -226,74 +296,6 @@ typedef struct __options { } Options; -/* - * Types of installed files. Keep in sync with - * manifest.c:packageEntryFileTypeTable[] - */ -typedef enum { - FILE_TYPE_NONE, - FILE_TYPE_KERNEL_MODULE_SRC, - FILE_TYPE_OPENGL_HEADER, - FILE_TYPE_OPENGL_LIB, - FILE_TYPE_DOCUMENTATION, - FILE_TYPE_OPENGL_SYMLINK, - FILE_TYPE_KERNEL_MODULE, - FILE_TYPE_INSTALLER_BINARY, - FILE_TYPE_UTILITY_BINARY, - FILE_TYPE_LIBGL_LA, - FILE_TYPE_TLS_LIB, - FILE_TYPE_TLS_SYMLINK, - FILE_TYPE_UTILITY_LIB, - 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, - FILE_TYPE_OPENCL_LIB, - FILE_TYPE_OPENCL_WRAPPER_LIB, - FILE_TYPE_CUDA_SYMLINK, - FILE_TYPE_OPENCL_LIB_SYMLINK, - FILE_TYPE_OPENCL_WRAPPER_SYMLINK, - FILE_TYPE_VDPAU_LIB, - FILE_TYPE_VDPAU_SYMLINK, - FILE_TYPE_UTILITY_BIN_SYMLINK, - FILE_TYPE_CUDA_ICD, - FILE_TYPE_NVCUVID_LIB, - FILE_TYPE_NVCUVID_LIB_SYMLINK, - FILE_TYPE_GLX_MODULE_SHARED_LIB, - FILE_TYPE_GLX_MODULE_SYMLINK, - FILE_TYPE_ENCODEAPI_LIB, - FILE_TYPE_ENCODEAPI_LIB_SYMLINK, - FILE_TYPE_VGX_LIB, - FILE_TYPE_VGX_LIB_SYMLINK, - FILE_TYPE_GRID_LIB, - FILE_TYPE_GRID_LIB_SYMLINK, - FILE_TYPE_APPLICATION_PROFILE, - FILE_TYPE_NVIDIA_MODPROBE, - FILE_TYPE_NVIDIA_MODPROBE_MANPAGE, - FILE_TYPE_MODULE_SIGNING_KEY, - FILE_TYPE_NVIFR_LIB, - FILE_TYPE_NVIFR_LIB_SYMLINK, - FILE_TYPE_XORG_OUTPUTCLASS_CONFIG, - FILE_TYPE_DKMS_CONF, - FILE_TYPE_GLVND_LIB, - FILE_TYPE_GLVND_SYMLINK, - FILE_TYPE_VULKAN_ICD_JSON, - FILE_TYPE_GLX_CLIENT_LIB, - FILE_TYPE_GLX_CLIENT_SYMLINK, - FILE_TYPE_GLVND_EGL_ICD_JSON, - FILE_TYPE_EGL_CLIENT_LIB, - FILE_TYPE_EGL_CLIENT_SYMLINK, - FILE_TYPE_EGL_EXTERNAL_PLATFORM_JSON, - FILE_TYPE_FLEXERA_LIB, - FILE_TYPE_FLEXERA_LIB_SYMLINK, - FILE_TYPE_ALLOCATOR_JSON, - FILE_TYPE_MAX -} PackageEntryFileType; - typedef enum { FILE_TLS_CLASS_NONE, FILE_TLS_CLASS_NEW, diff --git a/option_table.h b/option_table.h index 5283730..a0e6773 100644 --- a/option_table.h +++ b/option_table.h @@ -105,6 +105,7 @@ enum { GLVND_EGL_CONFIG_FILE_PATH_OPTION, GLVND_EGL_CLIENT_OPTION, EGL_EXTERNAL_PLATFORM_CONFIG_FILE_PATH_OPTION, + OVERRIDE_FILE_TYPE_DESTINATION_OPTION, }; static const NVGetoptOption __options[] = { @@ -669,6 +670,18 @@ static const NVGetoptOption __options[] = { "Defaults to " DEFAULT_EGL_EXTERNAL_PLATFORM_JSON_PATH "." }, + { "override-file-type-destination", + OVERRIDE_FILE_TYPE_DESTINATION_OPTION, NVGETOPT_STRING_ARGUMENT, NULL, + "Override the default destination for a file type. This option takes an " + "argument in the form of '<FILE_TYPE>:<destination>', where <FILE_TYPE> " + "is a file type from the installer .manifest file, and <destination> is " + "an absolute path to the directory where files of that type should be " + "installed. This option may be given multiple times in order to override " + "the destinations for multiple file types. Use of this option takes " + "precedence over any other options that might otherwise influence the " + "destination of the specified file type." + }, + /* Orphaned options: These options were in the long_options table in * nvidia-installer.c but not in the help. */ { "debug", 'd', 0, NULL,NULL }, @@ -1 +1 @@ -NVIDIA_VERSION = 396.45 +NVIDIA_VERSION = 396.51 |