1 |
commit: 57c250e24c70f8f9581860654cdec0d049345292 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 24 23:05:36 2021 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 24 23:05:36 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=57c250e2 |
7 |
|
8 |
generate /usr/lib/os-release dynamically |
9 |
|
10 |
This allows the os name and version to be dynamic. |
11 |
|
12 |
Bug: https://bugs.gentoo.org/788190 |
13 |
|
14 |
Signed-off-by: William Hubbs <williamh <AT> gentoo.org> |
15 |
|
16 |
Makefile | 3 +++ |
17 |
etc.BSD/os-release | 7 ------- |
18 |
etc.Linux/os-release | 7 ------- |
19 |
make_os_release | 15 +++++++++++++++ |
20 |
4 files changed, 18 insertions(+), 14 deletions(-) |
21 |
|
22 |
diff --git a/Makefile b/Makefile |
23 |
index a0204748..8d74853e 100644 |
24 |
--- a/Makefile |
25 |
+++ b/Makefile |
26 |
@@ -66,6 +66,9 @@ install: |
27 |
echo "Gentoo Base System release ${PV}" > ${DESTDIR}/etc/gentoo-release |
28 |
$(INSTALL_DIR) $(DESTDIR)/usr/share/baselayout |
29 |
cp -pPR share.$(OS)/* $(DESTDIR)/usr/share/baselayout/ |
30 |
+ $(INSTALL_DIR) $(DESTDIR)/usr/lib |
31 |
+ ./make_os_release $(OS) $(PV) > $(DESTDIR)/usr/lib/os-release |
32 |
+ ln -snf ../usr/lib/os-release ${DESTDIR}/etc/os-release |
33 |
|
34 |
layout-dirs: |
35 |
# Create base filesytem layout |
36 |
|
37 |
diff --git a/etc.BSD/os-release b/etc.BSD/os-release |
38 |
deleted file mode 100644 |
39 |
index d1d93391..00000000 |
40 |
--- a/etc.BSD/os-release |
41 |
+++ /dev/null |
42 |
@@ -1,7 +0,0 @@ |
43 |
-NAME=Gentoo |
44 |
-ID=gentoo |
45 |
-PRETTY_NAME="Gentoo/BSD" |
46 |
-ANSI_COLOR="1;32" |
47 |
-HOME_URL="https://www.gentoo.org/" |
48 |
-SUPPORT_URL="https://www.gentoo.org/support/" |
49 |
-BUG_REPORT_URL="https://bugs.gentoo.org/" |
50 |
|
51 |
diff --git a/etc.Linux/os-release b/etc.Linux/os-release |
52 |
deleted file mode 100644 |
53 |
index b8274bc8..00000000 |
54 |
--- a/etc.Linux/os-release |
55 |
+++ /dev/null |
56 |
@@ -1,7 +0,0 @@ |
57 |
-NAME=Gentoo |
58 |
-ID=gentoo |
59 |
-PRETTY_NAME="Gentoo Linux" |
60 |
-ANSI_COLOR="1;32" |
61 |
-HOME_URL="https://www.gentoo.org/" |
62 |
-SUPPORT_URL="https://www.gentoo.org/support/" |
63 |
-BUG_REPORT_URL="https://bugs.gentoo.org/" |
64 |
|
65 |
diff --git a/make_os_release b/make_os_release |
66 |
new file mode 100755 |
67 |
index 00000000..f764309c |
68 |
--- /dev/null |
69 |
+++ b/make_os_release |
70 |
@@ -0,0 +1,15 @@ |
71 |
+#!/bin/sh |
72 |
+if [ -z "${1}" ] || [ -z "${2}" ]; then |
73 |
+ printf 'usage: %s [os] [version]' "${0##*/}" >&2 |
74 |
+ exit 1 |
75 |
+fi |
76 |
+cat <<EOF |
77 |
+NAME=Gentoo |
78 |
+ID=gentoo |
79 |
+PRETTY_NAME="Gentoo ${1}" |
80 |
+ANSI_COLOR="1;32" |
81 |
+HOME_URL="https://www.gentoo.org/" |
82 |
+SUPPORT_URL="https://www.gentoo.org/support/" |
83 |
+BUG_REPORT_URL="https://bugs.gentoo.org/" |
84 |
+VERSION_ID="${2}" |
85 |
+EOF |