commit: f91c2b76255afe6baae7f720bc4dd9fe278998df Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Sat Aug 16 20:27:18 2025 +0000 Commit: Kerin Millar <kfm <AT> plushkava <DOT> net> CommitDate: Sat Aug 16 23:16:00 2025 +0000 URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f91c2b76
Let the config be set by LOCALEGEN_CONFIG in the environment This commit allows for the config file path to be explicitly specified by the LOCALEGEN_CONFIG environment variable. Both the -A and -c options take precedence, so one must refrain from specifying those for the variable to be considered. Bug: https://bugs.gentoo.org/961109 Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> locale-gen | 8 +++++--- locale-gen.8 | 12 ++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/locale-gen b/locale-gen index c415529..f0b85fe 100755 --- a/locale-gen +++ b/locale-gen @@ -204,10 +204,12 @@ sub select_config_files ($prefix, %opt) { return do { if (exists $opt{'config'}) { $opt{'config'}; - } elsif (! $opt{'all'}) { - $path1, $path2; - } else { + } elsif ($opt{'all'}) { $path2; + } elsif (exists $ENV{'LOCALEGEN_CONFIG'}) { + $ENV{'LOCALEGEN_CONFIG'}; + } else { + $path1, $path2; } }; } diff --git a/locale-gen.8 b/locale-gen.8 index 33342e6..a461a9a 100644 --- a/locale-gen.8 +++ b/locale-gen.8 @@ -22,14 +22,14 @@ The locale\-gen utility provides a means by which a system administrator may con .P A default installation of Gentoo Linux provides an archive that contains all supported locales, numbering 500 or more. However, it is typical for an administrator to require only one or two of these. In that case, the \fI/etc/locale.gen\fR configuration file may be populated with a list of the required locales. By default, locale\-gen shall read this file and compile only the locales that are specified, saving both time and space in the longer term. .P -If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option was specified. If specified then locale\-gen shall abort with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the \fB\-A\fR option had been specified. +If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option or LOCALEGEN_CONFIG environment variable was specified. If neither was specified, locale\-gen shall act as if the \fB\-A\fR option had been specified. Otherwise, locale\-gen shall abort with a suitable diagnostic message. .SH "OPTIONS" .TP \fB\-A\fR, \fB\-\-all\fR -Compile all locales that are officially supported by glibc. +Compile all locales that are officially supported by glibc. Cannot be combined with the \fB-c\fR option. .TP \fB\-c\fR, \fB\-\-config\fR \fIconfig\fR -Read the given \fIconfig\fR file (defaults to /etc/locale.gen). +Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). If the LOCALEGEN_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as the \fIconfig\fR file path instead. .TP \fB\-h\fR, \fB\-\-help\fR Write out a synopsis and summary of the supported options then exit. @@ -38,7 +38,7 @@ Write out a synopsis and summary of the supported options then exit. Spawn up to the specified number of \fIjobs\fR to compile locales in parallel (defaults to the number of logical processors). .TP \fB\-p\fR, \fB\-\-prefix\fR \fIprefix\fR -Treat most filesystem paths as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system). +Treat FILES as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system). Where explicitly specified, the \fIconfig\fR file shall be exempted from this behaviour. .TP \fB\-q\fR, \fB\-\-quiet\fR Suppress the writing of informational messages to standard output. @@ -58,6 +58,10 @@ A list of officially supported locales. .TP .I /usr/lib/locale/locale\-archive Contains the currently installed locales. +.SH "ENVIRONMENT" +.TP +LOCALEGEN_CONFIG +Defines the path of the \fIconfig\fR file in the absence of the \fB-A\fR and \fB-c\fR options. .SH "EXIT STATUS" The exit status shall be 0 under any of these conditions: .IP \[bu] 2
