diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2011-05-19 12:20:24 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2011-05-19 12:20:24 -0700 |
commit | dd78799e62baf5e8c1f568c0e5d4d556e0cc420b (patch) | |
tree | 0c49fc4838d58d40c8d6ecb1a433480a3c61506d | |
parent | 040e832482d2fe2dfdcd90544182029d9ef23171 (diff) |
275.09275.09
-rw-r--r-- | common-utils/nvgetopt.h | 8 | ||||
-rw-r--r-- | help-args.c | 9 | ||||
-rw-r--r-- | help-args.h | 2 | ||||
-rw-r--r-- | makeself-help-script.c | 4 | ||||
-rw-r--r-- | nvidia-installer.c | 55 | ||||
-rw-r--r-- | option_table.h | 64 | ||||
-rw-r--r-- | version.mk | 2 |
7 files changed, 98 insertions, 46 deletions
diff --git a/common-utils/nvgetopt.h b/common-utils/nvgetopt.h index 7083860..13b54d4 100644 --- a/common-utils/nvgetopt.h +++ b/common-utils/nvgetopt.h @@ -30,6 +30,14 @@ /* + * mask of bits not used by nvgetopt in NVGetoptOption::flags; + * these bits are available for use within specific users of + * nvgetopt + */ + +#define NVGETOPT_UNUSED_FLAG_RANGE 0xffff0000 + +/* * indicates that the option is a boolean value; the presence of the * option will be interpretted as a TRUE value; if the option is * prepended with '--no-', the option will be interpretted as a FALSE diff --git a/help-args.c b/help-args.c index a74d213..ec1d13a 100644 --- a/help-args.c +++ b/help-args.c @@ -66,7 +66,7 @@ static char *cook_description(const char *description) -void print_help_args_only(int args_only, int advanced) +void print_help_args_only(int is_uninstall, int args_only, int advanced) { int i, j, len; char *msg, *tmp, scratch[64]; @@ -93,6 +93,13 @@ void print_help_args_only(int args_only, int advanced) /* Skip options with no help text */ if (!o->description) continue; + /* Skip options that do not apply to nvidia-uninstall if we're + * invoked as nvidia-uninstall. */ + if (is_uninstall + && !(o->flags & NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL)) { + continue; + } + if (o->flags & NVGETOPT_IS_BOOLEAN) { msg = nvstrcat("--", o->name, "/--no-", o->name, NULL); } else if (isalnum(o->val)) { diff --git a/help-args.h b/help-args.h index 63b4be0..ac6e72d 100644 --- a/help-args.h +++ b/help-args.h @@ -28,6 +28,6 @@ #ifndef __HELP_ARGS_H__ #define __HELP_ARGS_H__ -void print_help_args_only(int args_only, int advanced); +void print_help_args_only(int is_uninstall, int args_only, int advanced); #endif /* __HELP_ARGS_H__ */ diff --git a/makeself-help-script.c b/makeself-help-script.c index 61ace43..de28611 100644 --- a/makeself-help-script.c +++ b/makeself-help-script.c @@ -25,9 +25,9 @@ int main(int argc, char **argv) } if (strcmp(argv[1], "--help-args-only") == 0) - print_help_args_only(TRUE, FALSE); + print_help_args_only(FALSE, TRUE, FALSE); else if (strcmp(argv[1], "--advanced-options-args-only") == 0) - print_help_args_only(TRUE, TRUE); + print_help_args_only(FALSE, TRUE, TRUE); else { print_usage(argv); exit(1); diff --git a/nvidia-installer.c b/nvidia-installer.c index 66dd54b..fa60223 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -55,7 +55,7 @@ #include "option_table.h" static void print_version(void); -static void print_help(int advanced); +static void print_help(const char* name, int is_uninstall, int advanced); @@ -71,7 +71,7 @@ static void print_version(void) fmtout(pNV_ID); fmtoutp(TAB, "The NVIDIA Software Installer for Unix/Linux."); fmtout(""); - fmtoutp(TAB, "This program is used to install and upgrade " + fmtoutp(TAB, "This program is used to install, upgrade and uninstall " "The NVIDIA Accelerated Graphics Driver Set for %s-%s.", INSTALLER_OS, INSTALLER_ARCH); fmtout(""); @@ -84,15 +84,15 @@ static void print_version(void) * print_help() - print usage information */ -static void print_help(int advanced) +static void print_help(const char* name, int is_uninstall, int advanced) { print_version(); fmtout(""); - fmtout("nvidia-installer [options]"); + fmtout("%s [options]", name); fmtout(""); - print_help_args_only(FALSE, advanced); + print_help_args_only(is_uninstall, FALSE, advanced); } /* print_help() */ @@ -146,8 +146,21 @@ static Options *load_default_options(void) static void parse_commandline(int argc, char *argv[], Options *op) { int c; + int print_help_after = FALSE; + int print_help_args_only_after = FALSE; + int print_advanced_help = FALSE; char *strval = NULL, *program_name = NULL; + /* + * if the installer was invoked as "nvidia-uninstall", perform an + * uninstallation. + */ + program_name = strdup(argv[0]); + if (strcmp(basename(program_name), "nvidia-uninstall") == 0) { + op->uninstall = TRUE; + } + free(program_name); + while (1) { c = nvgetopt(argc, argv, __options, &strval, @@ -176,8 +189,11 @@ static void parse_commandline(int argc, char *argv[], Options *op) case 'l': op->latest = TRUE; break; case 'm': op->ftp_site = strval; break; case 'f': op->update = op->force_update = TRUE; break; - case 'h': print_help(FALSE); exit(0); break; - case 'A': print_help(TRUE); exit(0); break; + case 'h': print_help_after = TRUE; break; + case 'A': + print_help_after = TRUE; + print_advanced_help = TRUE; + break; case 'q': op->no_questions = TRUE; break; case 'b': op->no_backup = TRUE; break; case 'K': @@ -241,7 +257,8 @@ static void parse_commandline(int argc, char *argv[], Options *op) case LOG_FILE_NAME_OPTION: op->log_file_name = strval; break; case HELP_ARGS_ONLY_OPTION: - print_help_args_only(TRUE, FALSE); exit(0); break; + print_help_args_only_after = TRUE; + break; case TMPDIR_OPTION: op->tmpdir = strval; break; case OPENGL_HEADERS_OPTION: @@ -277,7 +294,8 @@ static void parse_commandline(int argc, char *argv[], Options *op) op->add_this_kernel = TRUE; break; case ADVANCED_OPTIONS_ARGS_ONLY_OPTION: - print_help_args_only(TRUE, TRUE); exit(0); + print_help_args_only_after = TRUE; + print_advanced_help = TRUE; break; case RPM_FILE_LIST_OPTION: op->rpm_file_list = strval; @@ -354,6 +372,16 @@ static void parse_commandline(int argc, char *argv[], Options *op) } + if (print_help_after) { + print_help(argv[0], op->uninstall, print_advanced_help); + exit(0); + } + + if (print_help_args_only_after) { + print_help_args_only(op->uninstall, TRUE, print_advanced_help); + exit(0); + } + /* * if the installer prefix was not specified, default it to the * utility prefix; this is done so that the installer prefix is @@ -364,15 +392,6 @@ static void parse_commandline(int argc, char *argv[], Options *op) if (!op->installer_prefix) { op->installer_prefix = op->utility_prefix; } - - /* - * if the installer was invoked as "nvidia-uninstall", perform an - * uninstallation. - */ - program_name = strdup(argv[0]); - if (strcmp(basename(program_name), "nvidia-uninstall") == 0) - op->uninstall = TRUE; - free(program_name); return; diff --git a/option_table.h b/option_table.h index c009c16..b903df3 100644 --- a/option_table.h +++ b/option_table.h @@ -30,6 +30,14 @@ #include "nvgetopt.h" +#define NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL 0x00010000 + +/* make sure OPTION_APPLIES_TO_NVIDIA_UNINSTALL is in the approved range */ +#if !(NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL & NVGETOPT_UNUSED_FLAG_RANGE) +#error NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL incorrectly defined +#endif + + enum { XFREE86_PREFIX_OPTION = 1, OPENGL_PREFIX_OPTION, @@ -94,14 +102,17 @@ static const NVGetoptOption __options[] = { "other options given on the commandline will be passed on to the " "downloaded driver package when installing it." }, - { "version", 'v', NVGETOPT_HELP_ALWAYS, NULL, + { "version", 'v', + NVGETOPT_HELP_ALWAYS | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Print the nvidia-installer version and exit." }, - { "help", 'h', NVGETOPT_HELP_ALWAYS, NULL, + { "help", 'h', + NVGETOPT_HELP_ALWAYS | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Print usage information for the common commandline options " "and exit." }, - { "advanced-options", 'A', NVGETOPT_HELP_ALWAYS, NULL, + { "advanced-options", 'A', + NVGETOPT_HELP_ALWAYS | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Print usage information for the common commandline options " "as well as the advanced options, and then exit." }, @@ -118,13 +129,13 @@ static const NVGetoptOption __options[] = { "Perform basic sanity tests on an existing NVIDIA " "driver installation." }, - { "expert", 'e', 0, NULL, + { "expert", 'e', NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Enable 'expert' installation mode; more detailed questions " "will be asked, and more verbose output will be printed; " "intended for expert users. The questions may be suppressed " "with the '--no-questions' commandline option." }, - { "no-questions", 'q', 0, NULL, + { "no-questions", 'q', NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Do not ask any questions; the default (normally 'yes') " "is assumed for " "all yes/no questions, and the default string is assumed in " @@ -133,7 +144,7 @@ static const NVGetoptOption __options[] = { "license acceptance; the license may be accepted with the " "commandline option '--accept-license'." }, - { "silent", 's', 0, NULL, + { "silent", 's', NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Run silently; no questions are asked and no output is " "printed, except for error messages to stderr. This option " "implies '--ui=none --no-questions --accept-license'." }, @@ -277,12 +288,14 @@ static const NVGetoptOption __options[] = { "the currently running kernel. This option should only be needed " "in very rare circumstances." }, - { "log-file-name", LOG_FILE_NAME_OPTION, NVGETOPT_STRING_ARGUMENT, NULL, - "File name of the installation log file (the default is: " + { "log-file-name", LOG_FILE_NAME_OPTION, + NVGETOPT_STRING_ARGUMENT | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, + NULL, "File name of the installation log file (the default is: " "'" DEFAULT_LOG_FILE_NAME "')." }, - { "tmpdir", TMPDIR_OPTION, NVGETOPT_STRING_ARGUMENT, NULL, - "Use the specified directory as a temporary directory when " + { "tmpdir", TMPDIR_OPTION, + NVGETOPT_STRING_ARGUMENT | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, + NULL, "Use the specified directory as a temporary directory when " "downloading files from the NVIDIA ftp site; " "if not given, then the following list will be searched, and " "the first one that exists will be used: $TMPDIR, /tmp, ., " @@ -304,15 +317,16 @@ static const NVGetoptOption __options[] = { "thinks the latest driver is already installed; this option " "implies '--update'." }, - { "ui", USER_INTERFACE_OPTION, NVGETOPT_STRING_ARGUMENT, NULL, - "Specify what user interface to use, if available. " + { "ui", USER_INTERFACE_OPTION, + NVGETOPT_STRING_ARGUMENT | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, + NULL, "Specify what user interface to use, if available. " "Valid values for [UI] are 'ncurses' (the default) or 'none'. " "If the ncurses interface fails to initialize, or 'none' " "is specified, then a simple printf/scanf interface will " "be used." }, - { "no-ncurses-color", 'c', 0, NULL, - "Disable use of color in the ncurses user interface." }, + { "no-ncurses-color", 'c', NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, + NULL, "Disable use of color in the ncurses user interface." }, { "opengl-headers", OPENGL_HEADERS_OPTION, 0, NULL, "Normally, installation will not install NVIDIA's OpenGL " @@ -392,7 +406,8 @@ static const NVGetoptOption __options[] = { "and X server installation locations. With this option set, " "the installer will only search in the top-level directories." }, - { "kernel-module-only", 'K', 0, NULL, + { "kernel-module-only", 'K', + NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Install a kernel module only, and do not uninstall the " "existing driver. This is intended to be used to install kernel " "modules for additional kernels (in cases where you might boot " @@ -459,13 +474,14 @@ static const NVGetoptOption __options[] = { "(let nvidia-installer decide when to set the security type)." }, { "selinux-chcon-type", SELINUX_CHCON_TYPE_OPTION, - NVGETOPT_STRING_ARGUMENT, NULL, - "When SELinux support is enabled, nvidia-installer will try to determine " - "which chcon argument to use by first trying 'textrel_shlib_t', then " - "'texrel_shlib_t', then 'shlib_t'. Use this option to override this " - "detection logic." }, - - { "no-sigwinch-workaround", NO_SIGWINCH_WORKAROUND_OPTION, 0, NULL, + NVGETOPT_STRING_ARGUMENT | NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, + NULL, "When SELinux support is enabled, nvidia-installer will try to " + "determine which chcon argument to use by first trying " + "'textrel_shlib_t', then 'texrel_shlib_t', then 'shlib_t'. Use this " + "option to override this detection logic." }, + + { "no-sigwinch-workaround", NO_SIGWINCH_WORKAROUND_OPTION, + NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Normally, nvidia-installer ignores the SIGWINCH signal before it " "forks to execute commands, e.g. to build the kernel module, and " "restores the SIGWINCH signal handler after the child process " @@ -482,7 +498,8 @@ static const NVGetoptOption __options[] = { "installation in case of failures. Use this option to override this " "check." }, - { "no-distro-scripts", NO_DISTRO_SCRIPTS_OPTION, 0, NULL, + { "no-distro-scripts", NO_DISTRO_SCRIPTS_OPTION, + NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL, "Normally, nvidia-installer will run scripts from /usr/lib/nvidia before " "and after installing or uninstalling the driver. Use this option to " "disable execution of these scripts." }, @@ -500,4 +517,5 @@ static const NVGetoptOption __options[] = { { NULL, 0, 0, NULL }, }; + #endif /* __OPT_TABLE_H__ */ @@ -1 +1 @@ -NVIDIA_VERSION = 270.41.19 +NVIDIA_VERSION = 275.09 |