diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2018-08-16 18:37:58 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-19 16:35:22 +0100 |
commit | 72844f54318c31a0f05c75d59283f1fe92a1b1b7 (patch) | |
tree | 2aeae1b0948364780d07d27adb750bc1cd456de5 /meta/recipes-core | |
parent | 704e725bba37911e56ecd0edda694edfe9fce40f (diff) | |
download | poky-72844f54318c31a0f05c75d59283f1fe92a1b1b7.tar.gz |
glibc: re-package for libnss-db
On other distros like ubuntu/centos, libnss-db usually provides:
- The libraries
- The Makefile to create database
(in /var/db for centos, /var/lib/misc/ for ubuntu)
- The makedb command (it's in glibc-common for centos7)
What we had is:
- The libraries are in glibc-extra-nss
- The Makefile is removed
- The makedb command is in glibc-utils (lack of dependency)
So when glibc-extra-nss is installed but glibc-utils is not,
we see error like:
nscd[165]: 165 checking for monitored file `/var/db/group.db': No such file or directory
nscd[165]: 165 checking for monitored file `/var/db/passwd.db': No such file or directory
And there is not an easy way to create these databases.
To fix the issue:
- Re-package the libraries into libnss-db
- Don't remove the Makefile and add it in libnss-db
- Add RDEPENDS for libnss-db on glibc-utils
- Provide a shell script, makedbs.sh, to generate the db files.
This is to avoid dependency on 'make'.
Notes:
1. For external toolchain, an extra package 'libnss-db' need to be provided
If replacing glibc from core.
2. I've check the git history of nss/db-Makefile, the last two functionality
fix is as below.
- fix non-portable `echo -n` usage -- Date: Thu Aug 6 04:14:20 2015 -0400
- Fix db makefile rule for group.db -- Date: Fri Nov 11 14:43:36 2011 +0100
So I think this file is stable enough. And using makedbs.sh which is crafted according
to that file is not likely to cause maintanence problem.
(From OE-Core rev: 13cf502fce8956f95fdc8ac0c7a37d741223bcc9)
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/glibc/glibc-package.inc | 6 | ||||
-rwxr-xr-x | meta/recipes-core/glibc/glibc/makedbs.sh | 177 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc_2.28.bb | 1 |
3 files changed, 182 insertions, 2 deletions
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc index 07ce75df5d..9ea41b7b54 100644 --- a/meta/recipes-core/glibc/glibc-package.inc +++ b/meta/recipes-core/glibc/glibc-package.inc | |||
@@ -1,6 +1,6 @@ | |||
1 | INHIBIT_SYSROOT_STRIP = "1" | 1 | INHIBIT_SYSROOT_STRIP = "1" |
2 | 2 | ||
3 | PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" | 3 | PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" |
4 | 4 | ||
5 | # The ld.so in this glibc supports the GNU_HASH | 5 | # The ld.so in this glibc supports the GNU_HASH |
6 | RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)" | 6 | RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)" |
@@ -23,6 +23,8 @@ FILES_ldd = "${bindir}/ldd" | |||
23 | FILES_libsegfault = "${base_libdir}/libSegFault*" | 23 | FILES_libsegfault = "${base_libdir}/libSegFault*" |
24 | FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*" | 24 | FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*" |
25 | FILES_libmemusage = "${base_libdir}/libmemusage.so" | 25 | FILES_libmemusage = "${base_libdir}/libmemusage.so" |
26 | FILES_libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh" | ||
27 | RDEPENDS_libnss-db = "${PN}-utils" | ||
26 | FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" | 28 | FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" |
27 | FILES_sln = "${base_sbindir}/sln" | 29 | FILES_sln = "${base_sbindir}/sln" |
28 | FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" | 30 | FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" |
@@ -59,7 +61,6 @@ inherit libc-common multilib_header | |||
59 | 61 | ||
60 | do_install_append () { | 62 | do_install_append () { |
61 | rm -f ${D}${sysconfdir}/localtime | 63 | rm -f ${D}${sysconfdir}/localtime |
62 | rm -rf ${D}${localstatedir} | ||
63 | 64 | ||
64 | # remove empty glibc dir | 65 | # remove empty glibc dir |
65 | if [ -d ${D}${libexecdir} ]; then | 66 | if [ -d ${D}${libexecdir} ]; then |
@@ -95,6 +96,7 @@ do_install_append () { | |||
95 | install -d ${D}${localstatedir}/db/nscd | 96 | install -d ${D}${localstatedir}/db/nscd |
96 | install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd | 97 | install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd |
97 | install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf | 98 | install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf |
99 | install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db | ||
98 | sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd | 100 | sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd |
99 | sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf | 101 | sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf |
100 | 102 | ||
diff --git a/meta/recipes-core/glibc/glibc/makedbs.sh b/meta/recipes-core/glibc/glibc/makedbs.sh new file mode 100755 index 0000000000..7d51a67352 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/makedbs.sh | |||
@@ -0,0 +1,177 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # | ||
4 | # Make passwd.db, group.db, etc. | ||
5 | # | ||
6 | |||
7 | VAR_DB=/var/db | ||
8 | |||
9 | # Use make if available | ||
10 | if [ -x /usr/bin/make -o -x /bin/make ]; then | ||
11 | make -C $VAR_DB | ||
12 | exit 0 | ||
13 | fi | ||
14 | |||
15 | # No make available, do it in hard way | ||
16 | |||
17 | # passwd.db | ||
18 | if [ -e /etc/passwd ]; then | ||
19 | target=$VAR_DB/passwd.db | ||
20 | echo -n "passwd... " | ||
21 | awk 'BEGIN { FS=":"; OFS=":" } \ | ||
22 | /^[ \t]*$$/ { next } \ | ||
23 | /^[ \t]*#/ { next } \ | ||
24 | /^[^#]/ { printf ".%s ", $$1; print; \ | ||
25 | printf "=%s ", $$3; print }' /etc/passwd | \ | ||
26 | makedb --quiet -o $target - | ||
27 | echo "done." | ||
28 | fi | ||
29 | |||
30 | # group.db | ||
31 | if [ -e /etc/group ]; then | ||
32 | target=$VAR_DB/group.db | ||
33 | echo -n "group... " | ||
34 | awk 'BEGIN { FS=":"; OFS=":" } \ | ||
35 | /^[ \t]*$$/ { next } \ | ||
36 | /^[ \t]*#/ { next } \ | ||
37 | /^[^#]/ { printf ".%s ", $$1; print; \ | ||
38 | printf "=%s ", $$3; print; \ | ||
39 | if ($$4 != "") { \ | ||
40 | split($$4, grmems, ","); \ | ||
41 | for (memidx in grmems) { \ | ||
42 | mem=grmems[memidx]; \ | ||
43 | if (members[mem] == "") \ | ||
44 | members[mem]=$$3; \ | ||
45 | else \ | ||
46 | members[mem]=members[mem] "," $$3; \ | ||
47 | } \ | ||
48 | delete grmems; } } \ | ||
49 | END { for (mem in members) \ | ||
50 | printf ":%s %s %s\n", mem, mem, members[mem]; }' /etc/group | \ | ||
51 | makedb --quiet -o $target - | ||
52 | echo "done." | ||
53 | fi | ||
54 | |||
55 | # ethers.db | ||
56 | if [ -e /etc/ethers ]; then | ||
57 | target=$VAR_DB/ethers.db | ||
58 | echo -n "ethers... " | ||
59 | awk '/^[ \t]*$$/ { next } \ | ||
60 | /^[ \t]*#/ { next } \ | ||
61 | /^[^#]/ { printf ".%s ", $$1; print; \ | ||
62 | printf "=%s ", $$2; print }' /etc/ethers | \ | ||
63 | makedb --quiet -o $target - | ||
64 | echo "done." | ||
65 | fi | ||
66 | |||
67 | # protocols.db | ||
68 | if [ -e /etc/protocols ]; then | ||
69 | target=$VAR_DB/protocols.db | ||
70 | echo -n "protocols... " | ||
71 | awk '/^[ \t]*$$/ { next } \ | ||
72 | /^[ \t]*#/ { next } \ | ||
73 | /^[^#]/ { printf ".%s ", $$1; print; \ | ||
74 | printf "=%s ", $$2; print; \ | ||
75 | for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ | ||
76 | { printf ".%s ", $$i; print } }' /etc/protocols | \ | ||
77 | makedb --quiet -o $target - | ||
78 | echo "done." | ||
79 | fi | ||
80 | |||
81 | # rpc.db | ||
82 | if [ -e /etc/rpc ]; then | ||
83 | target=$VAR_DB/rpc.db | ||
84 | echo -n "rpc... " | ||
85 | awk '/^[ \t]*$$/ { next } \ | ||
86 | /^[ \t]*#/ { next } \ | ||
87 | /^[^#]/ { printf ".%s ", $$1; print; \ | ||
88 | printf "=%s ", $$2; print; \ | ||
89 | for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ | ||
90 | { printf ".%s ", $$i; print } }' /etc/rpc | \ | ||
91 | makedb --quiet -o $target - | ||
92 | echo "done." | ||
93 | fi | ||
94 | |||
95 | # services.db | ||
96 | if [ -e /etc/services ]; then | ||
97 | target=$VAR_DB/services.db | ||
98 | echo -n "services... " | ||
99 | awk 'BEGIN { FS="[ \t/]+" } \ | ||
100 | /^[ \t]*$$/ { next } \ | ||
101 | /^[ \t]*#/ { next } \ | ||
102 | /^[^#]/ { sub(/[ \t]*#.*$$/, "");\ | ||
103 | printf ":%s/%s ", $$1, $$3; print; \ | ||
104 | printf ":%s/ ", $$1; print; \ | ||
105 | printf "=%s/%s ", $$2, $$3; print; \ | ||
106 | printf "=%s/ ", $$2; print; \ | ||
107 | for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \ | ||
108 | { printf ":%s/%s ", $$i, $$3; print; \ | ||
109 | printf ":%s/ ", $$i; print } }' /etc/services | \ | ||
110 | makedb --quiet -o $target - | ||
111 | echo "done." | ||
112 | fi | ||
113 | |||
114 | # shadow.db | ||
115 | if [ -e /etc/shadow ]; then | ||
116 | target=$VAR_DB/shadow.db | ||
117 | echo -n "shadow... " | ||
118 | awk 'BEGIN { FS=":"; OFS=":" } \ | ||
119 | /^[ \t]*$$/ { next } \ | ||
120 | /^[ \t]*#/ { next } \ | ||
121 | /^[^#]/ { printf ".%s ", $$1; print }' /etc/shadow | \ | ||
122 | (umask 077 && makedb --quiet -o $target -) | ||
123 | echo "done." | ||
124 | if chgrp shadow $target 2>/dev/null; then | ||
125 | chmod g+r $target | ||
126 | else | ||
127 | chown 0 $target; chgrp 0 $target; chmod 600 $target; | ||
128 | echo | ||
129 | echo "Warning: The shadow password database $target" | ||
130 | echo "has been set to be readable only by root. You may want" | ||
131 | echo "to make it readable by the \`shadow' group depending" | ||
132 | echo "on your configuration." | ||
133 | echo | ||
134 | fi | ||
135 | fi | ||
136 | |||
137 | # gshadow.db | ||
138 | if [ -e /etc/gshadow ]; then | ||
139 | target=$VAR_DB/gshadow.db | ||
140 | echo -n "gshadow... " | ||
141 | awk 'BEGIN { FS=":"; OFS=":" } \ | ||
142 | /^[ \t]*$$/ { next } \ | ||
143 | /^[ \t]*#/ { next } \ | ||
144 | /^[^#]/ { printf ".%s ", $$1; print }' /etc/gshadow | \ | ||
145 | (umask 077 && makedb --quiet -o $target -) | ||
146 | echo "done." | ||
147 | if chgrp shadow $target 2>/dev/null; then | ||
148 | chmod g+r $target | ||
149 | else | ||
150 | chown 0 $target; chgrp 0 $target; chmod 600 $target | ||
151 | echo | ||
152 | echo "Warning: The shadow group database $target" | ||
153 | echo "has been set to be readable only by root. You may want" | ||
154 | echo "to make it readable by the \`shadow' group depending" | ||
155 | echo "on your configuration." | ||
156 | echo | ||
157 | fi | ||
158 | fi | ||
159 | |||
160 | # netgroup.db | ||
161 | if [ -e /etc/netgroup ]; then | ||
162 | target=$VAR_DB/netgroup.db | ||
163 | echo -n "netgroup... " | ||
164 | awk 'BEGIN { ini=1 } \ | ||
165 | /^[ \t]*$$/ { next } \ | ||
166 | /^[ \t]*#/ { next } \ | ||
167 | /^[^#]/ { if (sub(/[ \t]*\\$$/, " ") == 0) end="\n"; \ | ||
168 | else end=""; \ | ||
169 | gsub(/[ \t]+/, " "); \ | ||
170 | sub(/^[ \t]*/, ""); \ | ||
171 | if (ini == 0) printf "%s%s", $$0, end; \ | ||
172 | else printf ".%s %s%s", $$1, $$0, end; \ | ||
173 | ini=end == "" ? 0 : 1; } \ | ||
174 | END { if (ini==0) printf "\n" }' /etc/netgroup | \ | ||
175 | makedb --quiet -o $target | ||
176 | echo "done." | ||
177 | fi | ||
diff --git a/meta/recipes-core/glibc/glibc_2.28.bb b/meta/recipes-core/glibc/glibc_2.28.bb index 95e333dd5c..0ebbaf9610 100644 --- a/meta/recipes-core/glibc/glibc_2.28.bb +++ b/meta/recipes-core/glibc/glibc_2.28.bb | |||
@@ -17,6 +17,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)" | |||
17 | SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | 17 | SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ |
18 | file://etc/ld.so.conf \ | 18 | file://etc/ld.so.conf \ |
19 | file://generate-supported.mk \ | 19 | file://generate-supported.mk \ |
20 | file://makedbs.sh \ | ||
20 | \ | 21 | \ |
21 | ${NATIVESDKFIXES} \ | 22 | ${NATIVESDKFIXES} \ |
22 | file://0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ | 23 | file://0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ |