mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-23 15:31:05 +02:00
glibc: apply CoreOS tweaks
This time around our changes take a slightly different approach. Instead of editing the ebuild to undo things done in the common eblit code the eblits are edited directly, allowing for better customization. Also, managing locales is now different. Inside the SDK all locales are built at compile time, avoiding the need for locale-gen which is slow and complicates setup of the SDK chroot. For cross-compiled targets (CoreOS itself) final images don't include locale info either, again no need for locale-gen. The SDK is a bit bigger now, the compressed tarball is 20MB bigger and 200MB bigger extracted on disk. Considering how big it already is this shouldn't be that big of a deal.
This commit is contained in:
parent
87eea1180a
commit
bf8fe18b5a
@ -16,12 +16,6 @@ eblit-glibc-pkg_postinst() {
|
|||||||
# errors from this step #253697
|
# errors from this step #253697
|
||||||
/sbin/telinit U 2>/dev/null
|
/sbin/telinit U 2>/dev/null
|
||||||
|
|
||||||
# if the host locales.gen contains no entries, we'll install everything
|
## COREOS: locale-gen is not installed
|
||||||
local locale_list="${ROOT}etc/locale.gen"
|
|
||||||
if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
|
|
||||||
ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
|
|
||||||
locale_list="${ROOT}usr/share/i18n/SUPPORTED"
|
|
||||||
fi
|
|
||||||
locale-gen -j $(makeopts_jobs) --config "${locale_list}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,7 @@ eblit-glibc-pkg_preinst() {
|
|||||||
# prepare /etc/ld.so.conf.d/ for files
|
# prepare /etc/ld.so.conf.d/ for files
|
||||||
mkdir -p "${EROOT}"/etc/ld.so.conf.d
|
mkdir -p "${EROOT}"/etc/ld.so.conf.d
|
||||||
|
|
||||||
# Default /etc/hosts.conf:multi to on for systems with small dbs.
|
## COREOS: host.conf is not installed
|
||||||
if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
|
|
||||||
sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
|
|
||||||
elog "Defaulting /etc/host.conf:multi to on"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ ${ROOT} != "/" ]] && return 0
|
[[ ${ROOT} != "/" ]] && return 0
|
||||||
[[ -d ${D}/$(get_libdir) ]] || return 0
|
[[ -d ${D}/$(get_libdir) ]] || return 0
|
||||||
|
@ -133,70 +133,40 @@ toolchain-glibc_src_install() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Files for Debian-style locale updating
|
## COREOS ##
|
||||||
dodir /usr/share/i18n
|
# For reference, the rest of this function has been modified to do:
|
||||||
sed \
|
# - The SDK just gets the full locale archive, no need for locale-gen.
|
||||||
-e "/^#/d" \
|
# - CoreOS targets (which are cross compiled) don't get any locales.
|
||||||
-e "/SUPPORTED-LOCALES=/d" \
|
# - Config files are installed by baselayout, not glibc.
|
||||||
-e "s: \\\\::g" -e "s:/: :g" \
|
# - Forget about nscd for now, we have the use flag off anyway.
|
||||||
"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
|
|
||||||
|| die "generating /usr/share/i18n/SUPPORTED failed"
|
if ! tc-is-cross-compiler ; then
|
||||||
cd "${WORKDIR}"/extra/locale
|
emake install_root="${D}$(alt_prefix)" localedata/install-locales || die
|
||||||
dosbin locale-gen || die
|
# Sanity check the above command worked
|
||||||
doman *.[0-8]
|
[[ -f ${ED}/usr/$(get_libdir)/locale/locale-archive ]] || die
|
||||||
insinto /etc
|
else
|
||||||
doins locale.gen || die
|
keepdir /usr/$(get_libdir)/locale
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure all the ABI's can find the locales and so we only
|
# Make sure all the ABI's can find the locales and so we only
|
||||||
# have to generate one set
|
# have to generate one set
|
||||||
local a
|
local a
|
||||||
keepdir /usr/$(get_libdir)/locale
|
|
||||||
for a in $(get_install_abis) ; do
|
for a in $(get_install_abis) ; do
|
||||||
if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
|
if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
|
||||||
dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
|
dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cd "${S}"
|
# Clean out any default configs
|
||||||
|
rm -rf "${ED}"/etc
|
||||||
# Install misc network config files
|
|
||||||
insinto /etc
|
|
||||||
doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
|
|
||||||
doins "${WORKDIR}"/extra/etc/*.conf || die
|
|
||||||
|
|
||||||
if ! in_iuse nscd || use nscd ; then
|
|
||||||
doinitd "${WORKDIR}"/extra/etc/nscd || die
|
|
||||||
|
|
||||||
local nscd_args=(
|
|
||||||
-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
|
|
||||||
)
|
|
||||||
version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
|
|
||||||
sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
|
|
||||||
|
|
||||||
# Newer versions of glibc include the nscd.service themselves.
|
|
||||||
# TODO: Drop the $FILESDIR copy once 2.19 goes stable.
|
|
||||||
if version_is_at_least 2.19 ; then
|
|
||||||
systemd_dounit nscd/nscd.service || die
|
|
||||||
systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
|
|
||||||
else
|
|
||||||
systemd_dounit "${FILESDIR}"/nscd.service || die
|
|
||||||
systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Do this since extra/etc/*.conf above might have nscd.conf.
|
|
||||||
rm -f "${ED}"/etc/nscd.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
|
echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
|
||||||
doenvd "${T}"/00glibc || die
|
doenvd "${T}"/00glibc || die
|
||||||
|
|
||||||
|
cd "${S}"
|
||||||
for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
|
for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
|
||||||
[[ -s ${d} ]] && dodoc ${d}
|
[[ -s ${d} ]] && dodoc ${d}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Prevent overwriting of the /etc/localtime symlink. We'll handle the
|
|
||||||
# creation of the "factory" symlink in pkg_postinst().
|
|
||||||
rm -f "${ED}"/etc/localtime
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain-glibc_headers_install() {
|
toolchain-glibc_headers_install() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user