Skip to content

Commit d5d5253

Browse files
author
cyeoh
committed
Fix bugs reported by Dominique
1 parent d990a2b commit d5d5253

File tree

5 files changed

+40
-51
lines changed

5 files changed

+40
-51
lines changed

lsb_release/src/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ all: man
1010
man: lsb_release.1.gz
1111

1212
lsb_release.1.gz: lsb_release
13-
@cp -p lsb_release lsb_release.orig
14-
@cat lsb_release.orig | sed -e "s/\[ -n \"\$ARG_V\" \] \&\& DisplayVersion/\[ -n \"\$ARG_V\" \] \&\& Version/" >./lsb_release
15-
@chmod a+x ./lsb_release
16-
@./help2man -N --include ./lsb_release.examples ./lsb_release >lsb_release.1
17-
@mv lsb_release.orig lsb_release
18-
@gzip -f lsb_release.1
13+
@./help2man -N --include ./lsb_release.examples --alt_version_key=program_version ./lsb_release >lsb_release.1
14+
# @gzip -f lsb_release.1
1915

2016
install: all
2117
install -D -m 644 lsb_release.1.gz ${prefix}/man/man1/lsb_release.1.gz

lsb_release/src/doman

Lines changed: 0 additions & 27 deletions
This file was deleted.

lsb_release/src/help2man

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
# Written by Brendan O'Dea <bod@compusol.com.au>
2121
# Available from ftp://ftp.gnu.org/gnu/help2man/
2222

23+
# This has been modified by Chris Yeoh <cyeoh@linuxcare.com.au> to
24+
# handle non
25+
2326
use 5.004;
2427
use strict;
2528
use Getopt::Long;
@@ -43,14 +46,15 @@ my $help_info = <<EOT;
4346
4447
Usage: $this_program [OPTION]... EXECUTABLE
4548
46-
-n, --name=STRING use `STRING' as the description for the NAME paragraph
47-
-s, --section=SECTION use `SECTION' as the section for the man page
48-
-i, --include=FILE include material from `FILE'
49-
-I, --opt-include=FILE include material from `FILE' if it exists
50-
-o, --output=FILE send output to `FILE'
51-
-N, --no-info suppress pointer to Texinfo manual
52-
--help print this help, then exit
53-
--version print version number, then exit
49+
-n, --name=STRING use `STRING' as the description for the NAME paragraph
50+
-s, --section=SECTION use `SECTION' as the section for the man page
51+
-i, --include=FILE include material from `FILE'
52+
-I, --opt-include=FILE include material from `FILE' if it exists
53+
-o, --output=FILE send output to `FILE'
54+
-N, --no-info suppress pointer to Texinfo manual
55+
--alt_version_key=KEY use specified flag instead of --version
56+
--help print this help, then exit
57+
--version print version number, then exit
5458
5559
EXECUTABLE should accept `--help' and `--version' options.
5660
@@ -59,6 +63,7 @@ EOT
5963

6064
my $section = 1;
6165
my ($opt_name, @opt_include, $opt_output, $opt_no_info);
66+
my($opt_version_key) = "version";
6267

6368
# Parse options.
6469
Getopt::Long::config('bundling');
@@ -69,6 +74,7 @@ GetOptions (
6974
'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] },
7075
'o|output=s' => \$opt_output,
7176
'N|no-info' => \$opt_no_info,
77+
'alt_version_key=s' => \$opt_version_key,
7278
help => sub { print $help_info; exit },
7379
version => sub { print $version_info; exit },
7480
) or die $help_info;
@@ -164,7 +170,7 @@ setlocale LC_TIME, 'C';
164170
my ($help_text, $version_text) = map {
165171
join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null`
166172
or die "$this_program: can't get `--$_' info from $ARGV[0]\n"
167-
} qw(help version);
173+
} qw(help), $opt_version_key;
168174

169175
my $date = strftime "%B %Y", localtime;
170176
(my $program = $ARGV[0]) =~ s!.*/!!;
@@ -467,11 +473,11 @@ EOT
467473
# Output header.
468474
print <<EOT;
469475
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
470-
.TH $PROGRAM "$section" "$date" "$package $version" FSF
476+
.TH $PROGRAM "$section" "$date" "$package $version" FSG
471477
EOT
472478

473479
# Section ordering.
474-
my @pre = qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES);
480+
my @pre = qw(NAME SYNOPSIS DESCRIPTION OPTIONS FILES EXAMPLES);
475481
my @post = ('AUTHOR', 'REPORTING BUGS', 'COPYRIGHT', 'SEE ALSO');
476482
my $filter = join '|', @pre, @post;
477483

lsb_release/src/lsb_release

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ DESCSTR_DELI="release"
6262
# FUNCTIONS
6363
###############################################################################
6464

65+
function DisplayProgramVersion() {
66+
echo "GNU ${0##*/} $SCRIPTVERSION"
67+
echo
68+
echo "Copyright (C) 2000 Free Software Group, Inc."
69+
echo "This is free software; see the source for copying conditions. There\
70+
is NO"
71+
echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR\
72+
PURPOSE."
73+
echo
74+
echo "Written by Dominique MASSONIE."
75+
}
76+
6577
# defines the Usage for lsb_release
6678
Usage() {
6779
echo "LSB `basename $0` $SCRIPTVERSION print certain LSB (Linux\
@@ -97,14 +109,14 @@ EnhancedGetopt() {
97109
getopt -T >/dev/null 2>&1 # is getopt the enhanced one ?
98110
if [ $? = 4 ]
99111
then # Yes, advanced args ALLOWED
100-
OPT=$(getopt -o acdhirsv \
101-
--long all,codename,description,help,id,release,short,version \
112+
OPT=$(getopt -o acdhirsvp \
113+
--long all,codename,description,help,id,release,short,version,program_version \
102114
-n 'lsb_release' \
103115
-- "$@")
104116
else # No, advanced args NOT allowed
105117
# convert (if needed) the enhanced options into basic ones
106118
MYARGS=$(echo "$@" | sed -e "/--/s/-\(-[[:alnum:]]\)[[:alnum:]]*/\1/g")
107-
OPT=$(getopt -o acdhirsv \
119+
OPT=$(getopt -o acdhirsvp \
108120
-n 'lsb_release' \
109121
-- "$MYARGS")
110122
fi
@@ -122,7 +134,8 @@ EnhancedGetopt() {
122134
-r|--release) ARG_R="y"; shift;;
123135
-s|--short) ARG_S="y"; shift;;
124136
-v|--version) ARG_V="y"; shift;;
125-
-h|--help) Usage;;
137+
-p|--program_version) ARG_P="y"; shift;;
138+
-h|--help) Usage;;
126139
--) shift; break;;
127140
*) EXIT_STATUS=$ERROR_USER
128141
Usage;;
@@ -360,6 +373,7 @@ GetLSBInfo
360373
GetDistribInfo
361374

362375
# Display requested infos (order as follow)
376+
[ -n "$ARG_P" ] && DisplayProgramVersion
363377
[ -n "$ARG_V" ] && DisplayVersion
364378
[ -n "$ARG_I" ] && DisplayID
365379
[ -n "$ARG_D" ] && DisplayDescription

lsb_release/src/lsb_release.examples

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[FILES]
22
The \fB"/etc/lsb-release"\fR file should contain the following fields:
33

4-
\fBLSB_VERSION="1.0"\fR (REQUIRED)
4+
\fBLSB_VERSION="\fR1.0\fB"\fR (REQUIRED)
55

66
And some optional fields like
77
\fBDISTRIB_ID\fR, \fBDISTRIB_RELEASE\fR, \fBDISTRIB_CODENAME\fR, \fBDISTRIB_DESCRIPTION\fR
@@ -20,7 +20,7 @@ Where \fIDistributor\fR can be a couple of words, but then concatenated (i.e. Li
2020

2121
And \fBrelease\fR is a keyword not to be used in \fBDISTRIB_DESCRIPTION\fR if you don't want to overwrite "/etc/[distrib]-release" data.
2222

23-
\fBNotice:\fR To support the \fBDebian\fR distributions' lak of information (see "/etc/debian_version" file) some have been directly added into the \fBlsb_release\fR script.
23+
\fBNotice:\fR To support the \fBDebian\fR distributions' lack of information (see "/etc/debian_version" file) some have been directly added into the \fBlsb_release\fR script.
2424

2525
[EXAMPLES]
2626
.B The "/etc/lsb-release" file contains:
@@ -65,4 +65,4 @@ Codename: TryIt
6565

6666
[REPORTING BUGS]
6767
Report bugs to <mdomi@users.sourceforge.net>.
68-
Include a complete, selfcontained example that will allow the bug to be reproduced, and say which version of lsb_release you are using.
68+
Include a complete, self contained example that will allow the bug to be reproduced, and say which version of lsb_release you are using.

0 commit comments

Comments
 (0)