Skip to content

Commit d9df4d4

Browse files
committed
First try at the module update.
1 parent 68f975e commit d9df4d4

4 files changed

Lines changed: 72 additions & 32 deletions

File tree

lsb_release/src/INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This dir contains the lsb_release script and the required
22
programs to build the associated man pages.
33

44
README
5-
lsb_release : version 1.4
5+
lsb_release : version 2.0
66
help2man : the GNU script to build Man from --help output
77
Makefile : Makefile for creating the man page
88
lsb_release.examples : the Man style add-on for the pages

lsb_release/src/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#
22
# Makefile for lsb_release program
33
#
4-
# Copyright (C) 2000 Free Software Group, Inc
5-
# Copyright (C) 2002 Free Software Group, Inc
4+
# Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc
65
#
76
# Christopher Yeoh <cyeoh@samba.org>
87
#
9-
# This is $Revision: 1.6 $
8+
# This is $Revision: 1.7 $
109

1110
# Config
1211

lsb_release/src/lsb_release

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
#!/bin/sh
22
# About: This shell script is the lsb_release implementation,
33
# Version: see SCRIPTVERSION (in the Declarations section)
4-
# Licence: GPL (latest version), Free Software Group, Inc
4+
# Licence: GPL (latest version), Free Standards Group, Inc
55
# Author: Dominique MASSONIE <mdomi@users.sourceforge.net>
66
# Date: September 27th, 2000
77
#
8+
# * Changes in 2.0
9+
# - Support LSB 2.0 module layout (Mats Wichmann)
10+
# The LSB_VERSION is now a colon-separated field of supported module versions
11+
# An /etc/lsb-release.d is searched for modules beyond the core.
12+
# Only the filenames in this directory is looked at, those names are added
13+
# to LSB_VERSION. This allows module support to be handled easily by
14+
# package install/removal without a need to edit lsb-release on the fly.
15+
# - Correct license: FSG == Free Standards Group, Inc.
16+
#
817
# * Changes in 1.4
918
# - "awk" not needed anymore (Loic Lefort)
1019
# - fixed bug #121879 reported by Chris D. Faulhaber,
@@ -21,29 +30,31 @@
2130
# - LSB_VERSION is no longer required in /etc/lsb-release file
2231
#
2332
# * Changes in 1.1
24-
# - removed some bash-ism and typos (me)
33+
# - removed some bash-ism and typos
2534
# Notice: script remains broken with ash because of awk issues
26-
# - changed licence to FSG - "Free Software Group, Inc" (me)
27-
# - fixed problem with --short single arg call (me)
28-
# - changed Debian specifics, codename anticipates release num (me)
35+
# - changed licence to FSG - "Free Software Group, Inc"
36+
# - fixed problem with --short single arg call
37+
# - changed Debian specifics, codename anticipates release num
2938
#
3039
# Description:
31-
# Collect informations from sourceable /etc/lsb-release file (present on
40+
# Collect information from sourceable /etc/lsb-release file (present on
3241
# LSB-compliant systems) : LSB_VERSION, DISTRIB_ID, DISTRIB_RELEASE,
33-
# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional).
34-
# Then (if needed) find and parse the /etc/[distro]-release file.
42+
# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional)
43+
# Then (if needed) find and add names from /etc/lsb-release.d
44+
# Then (if needed) find and parse the /etc/[distro]-release file
3545

3646

3747
###############################################################################
3848
# DECLARATIONS
3949
###############################################################################
4050

4151
# This script version
42-
SCRIPTVERSION="1.4"
52+
SCRIPTVERSION="2.0"
4353

4454
# Defines the data files
4555
INFO_ROOT="/etc" # directory of config files
4656
INFO_LSB_FILE="lsb-release" # where to get LSB version
57+
INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules
4758
INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix>
4859
ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib]
4960
ALTERNATE_DISTRIB_NAME="Debian" # "
@@ -79,13 +90,13 @@ DESCSTR_DELI="release"
7990
DisplayProgramVersion() {
8091
echo "FSG `basename $0` v$SCRIPTVERSION"
8192
echo
82-
echo "Copyright (C) 2000 Free Software Group, Inc."
93+
echo "Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc."
8394
echo "This is free software; see the source for copying conditions. There\
8495
is NO"
8596
echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR\
8697
PURPOSE."
8798
echo
88-
echo "Written by Dominique MASSONIE."
99+
echo "Originally written by Dominique MASSONIE."
89100

90101
exit $EXIT_STATUS
91102
}
@@ -168,7 +179,19 @@ GetLSBInfo() {
168179
# should init at least LSB_VERSION
169180
. "$INFO_ROOT/$INFO_LSB_FILE"
170181
fi
171-
[ -z "$LSB_VERSION" ] && LSB_VERSION=$MSG_NA
182+
if [ -z "$LSB_VERSION" ]
183+
then
184+
LSB_VERSION=$MSG_NA
185+
else
186+
# if we found LSB_VERSION, continue to look in directory
187+
if [ -d "$INFO_ROOT/$INFO_LSB_DIR" ]
188+
then
189+
for tag in "$INFO_ROOT/$INFO_LSB_DIR/"*
190+
do
191+
LSB_VERSION=$LSB_VERSION:`basename $tag`
192+
done
193+
fi
194+
fi
172195
}
173196

174197
# Get the whole distrib information string (from ARG $1 file)
Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,64 @@
11
[FILES]
22

33
If the installation is LSB compliant, the \fB"/etc/lsb-release"\fR
4-
file should contain the \fBLSB_VERSION\fR field. The value of the
5-
field should be the version number of the LSB specification against
6-
which the installation is compliant. If the installation is not
4+
file should contain the \fBLSB_VERSION\fR field.
5+
The value of the field should be a colon separated list of
6+
supported module versions indicating the LSB specification
7+
modules to which the installation is compliant. If the installation is not
78
compliant, the above field should
89
.B not
910
be present.
1011

1112
Optional fields are \fBDISTRIB_ID\fR, \fBDISTRIB_RELEASE\fR,
1213
\fBDISTRIB_CODENAME\fR, \fBDISTRIB_DESCRIPTION\fR and can be used to
13-
overwrite information which is parsed from the next file.
14+
override information which is parsed from the
15+
\fB"/etc/\fIdistrib\fB-release"\fR file.
16+
17+
If the \fB"/etc/lsb-release.d"\fR directory exists, it is
18+
searched for filenames which are taken as additional module-version
19+
strings to add to \fBLSB_VERSION\fR.
1420

15-
The \fB"/etc/[distrib]-release"\fR file contains a description line
21+
The \fB"/etc/\fIdistrib\fB-release"\fR file contains a description line
1622
which is parsed to get information (especially on currently non-LSB
1723
compliant systems).
1824

1925
The required line style is:
2026
.br
2127
"\fIDistributor\fR \fBrelease\fR \fIx.x\fR \fB(\fR\fICodename\fR\fB)\fR"
2228

23-
Where \fIDistributor\fR can be a couple of words, but then concatenated (i.e. Linux Foo BarLinux Linux -> FooBarLinux),
29+
Where \fIDistributor\fR can be a couple of words, but then concatenated
30+
(i.e. Linux Foo BarLinux Linux -> FooBarLinux),
2431
.br
2532
\fIx.x\fR starts with a digit followed by any non-blank characters,
2633
\fICodename\fR will also be concatenated (blanks cleanup only).
2734

28-
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.
35+
\fBrelease\fR may not be used as a keyword in \fBDISTRIB_DESCRIPTION\fR
36+
if you don't want to override \fB"/etc/\fIdistrib\fB-release"\fR data.
2937

30-
\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.
38+
\fBNotice:\fR To support the \fBDebian\fR distributions' lack of
39+
information (see "/etc/debian_version" file) some have been directly
40+
added into the \fBlsb_release\fR script.
3141

3242
[EXAMPLES]
33-
.B The "/etc/lsb-release" file contains:
43+
If the "\fB/etc/lsb-release\fR" file contains:
3444

35-
LSB_VERSION="1.0"
45+
LSB_VERSION="core-2.0-ia64:core-2.0-noarch"
3646
.br
3747
DISTRIB_DESCRIPTION="I enjoy using my distrib"
3848

39-
.B And the "/etc/foobar-release" file contains:
49+
and the "\fB/etc/lsb-release.d\fR" directory contains:
50+
51+
graphics-2.0-ia64 graphics-2.0-noarch
52+
53+
and the "\fB/etc/foobar-release\fP" file contains:
4054

4155
My Linux Distrib release 1.0RC4 (TryIt)
4256

57+
Then the results of various options will be:
58+
4359
.B $ ./lsb_release --all
4460
.br
45-
LSB Version: core-2.0-ia32:graphics-2.0-ia32
61+
LSB Version: core-2.0-ia64:core-2.0-noarch:graphics-2.0-ia64:graphics-2.0-noarch
4662
.br
4763
Distributor ID: MyDistrib
4864
.br
@@ -56,8 +72,9 @@ Codename: TryIt
5672
.br
5773
1.0 MyDistrib "I enjoy using my distrib" 1.0RC4 TryIt
5874

59-
Then simply without the "/etc/lsb-release" file, that means result on a \fBnon-LSB\fR compliant distrib:
60-
.br
75+
If the "/etc/lsb-release" file is absent (indicating this is
76+
not an LSB compliant distribution), the result will be:
77+
6178
.B $ ./lsb_release -a
6279
.br
6380
LSB Version: n/a
@@ -71,5 +88,6 @@ Release: 1.0RC4
7188
Codename: TryIt
7289

7390
[REPORTING BUGS]
74-
Report bugs to <mdomi@users.sourceforge.net>.
75-
Include a complete, self contained example that will allow the bug to be reproduced, and say which version of lsb_release you are using.
91+
Report bugs at http://bugs.linuxbase.org.
92+
Please include a complete, self contained example that will allow the
93+
bug to be reproduced, and say which version of lsb_release you are using.

0 commit comments

Comments
 (0)