|
1 | 1 | #!/bin/sh |
2 | 2 | # About: This shell script is the lsb_release implementation, |
3 | 3 | # 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 |
5 | 5 | # Author: Dominique MASSONIE <mdomi@users.sourceforge.net> |
6 | 6 | # Date: September 27th, 2000 |
7 | 7 | # |
| 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 | +# |
8 | 17 | # * Changes in 1.4 |
9 | 18 | # - "awk" not needed anymore (Loic Lefort) |
10 | 19 | # - fixed bug #121879 reported by Chris D. Faulhaber, |
|
21 | 30 | # - LSB_VERSION is no longer required in /etc/lsb-release file |
22 | 31 | # |
23 | 32 | # * Changes in 1.1 |
24 | | -# - removed some bash-ism and typos (me) |
| 33 | +# - removed some bash-ism and typos |
25 | 34 | # 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 |
29 | 38 | # |
30 | 39 | # Description: |
31 | | -# Collect informations from sourceable /etc/lsb-release file (present on |
| 40 | +# Collect information from sourceable /etc/lsb-release file (present on |
32 | 41 | # 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 |
35 | 45 |
|
36 | 46 |
|
37 | 47 | ############################################################################### |
38 | 48 | # DECLARATIONS |
39 | 49 | ############################################################################### |
40 | 50 |
|
41 | 51 | # This script version |
42 | | -SCRIPTVERSION="1.4" |
| 52 | +SCRIPTVERSION="2.0" |
43 | 53 |
|
44 | 54 | # Defines the data files |
45 | 55 | INFO_ROOT="/etc" # directory of config files |
46 | 56 | INFO_LSB_FILE="lsb-release" # where to get LSB version |
| 57 | +INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules |
47 | 58 | INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix> |
48 | 59 | ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib] |
49 | 60 | ALTERNATE_DISTRIB_NAME="Debian" # " |
@@ -79,13 +90,13 @@ DESCSTR_DELI="release" |
79 | 90 | DisplayProgramVersion() { |
80 | 91 | echo "FSG `basename $0` v$SCRIPTVERSION" |
81 | 92 | echo |
82 | | - echo "Copyright (C) 2000 Free Software Group, Inc." |
| 93 | + echo "Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc." |
83 | 94 | echo "This is free software; see the source for copying conditions. There\ |
84 | 95 | is NO" |
85 | 96 | echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR\ |
86 | 97 | PURPOSE." |
87 | 98 | echo |
88 | | - echo "Written by Dominique MASSONIE." |
| 99 | + echo "Originally written by Dominique MASSONIE." |
89 | 100 |
|
90 | 101 | exit $EXIT_STATUS |
91 | 102 | } |
@@ -168,7 +179,19 @@ GetLSBInfo() { |
168 | 179 | # should init at least LSB_VERSION |
169 | 180 | . "$INFO_ROOT/$INFO_LSB_FILE" |
170 | 181 | 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 |
172 | 195 | } |
173 | 196 |
|
174 | 197 | # Get the whole distrib information string (from ARG $1 file) |
|
0 commit comments