overlay: Move our bash modifications to a separate package

The new coreos-base/misc-files package will contain the compatibility
symlinks and other files we added as modifications to Gentoo
ebuilds. Now we will be moving the app-shells/bash package to
portage-stable, so move our bashrc snippet and symlink creation to the
new package.
This commit is contained in:
Krzesimir Nowak 2023-05-02 16:44:06 +02:00
parent 27f20f6e26
commit c2524a6d2d
6 changed files with 70 additions and 9 deletions

View File

@ -16,12 +16,3 @@ fi
# Put your fun stuff here.
alias_bcc_tool() {
local tool="${1}"
alias iovisor-${tool}="docker run --rm -it -v /lib/modules:/lib/modules -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/fs/bpf:/sys/fs/bpf --privileged --net host --pid host quay.io/iovisor/bcc /usr/share/bcc/tools/${tool}"
}
bcc_debug_toolset=( tcpretrans tcpconnect tcpaccept biolatency )
for t in "${bcc_debug_toolset[@]}"; do alias_bcc_tool "${t}"; done

View File

@ -113,6 +113,7 @@ RDEPEND="${RDEPEND}
coreos-base/afterburn
coreos-base/coreos-cloudinit
coreos-base/coreos-init
coreos-base/misc-files
coreos-base/update-ssh-keys
coreos-base/update_engine
dev-db/etcdctl

View File

@ -0,0 +1,5 @@
for iovisor_bcc_tool in tcpretrans tcpconnect tcpaccept biolatency; do
alias "iovisor-${iovisor_bcc_tool}=docker run --rm -it -v /lib/modules:/lib/modules -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/fs/bpf:/sys/fs/bpf --privileged --net host --pid host quay.io/iovisor/bcc /usr/share/bcc/tools/${iovisor_bcc_tool}"
done
unset -v iovisor_bcc_tool

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
</pkgmetadata>

View File

@ -0,0 +1,60 @@
# Copyright (c) 2023 The Flatcar Maintainers.
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DESCRIPTION='Flatcar miscellaneous files'
HOMEPAGE='https://www.flatcar.org/'
LICENSE='Apache-2.0'
SLOT='0'
KEYWORDS='amd64 arm64'
# No source directory.
S="${WORKDIR}"
# Versions listed below are version of packages that shedded the
# modifications in their ebuilds.
RDEPEND="
>=app-shells/bash-5.2_p15-r2
"
src_compile() {
# An empty file for temporary symlink destinations under
# /usr/share/flatcar/etc.
touch "${T}/empty-file"
}
src_install() {
# Use absolute paths to be clear about what locations are used. The
# dosym below will make relative paths out of them.
#
# For files inside /usr/share/flatcar/etc the ebuild will create empty
# files to avoid having dangling symlinks. During the assembly of the
# image, the /usr/share/flatcar/etc directory will be removed, and
# /etc will be moved in its place.
#
# These links exist because old installations can still have
# references to `/usr/share/(bash|skel)`.
local -A compat_symlinks
compat_symlinks=(
['/usr/share/bash/bash_logout']='/usr/share/flatcar/etc/bash/bash_logout'
['/usr/share/bash/bashrc']='/usr/share/flatcar/etc/bash/bashrc'
['/usr/share/skel/.bash_logout']='/usr/share/flatcar/etc/skel/.bash_logout'
['/usr/share/skel/.bash_profile']='/usr/share/flatcar/etc/skel/.bash_profile'
['/usr/share/skel/.bashrc']='/usr/share/flatcar/etc/skel/.bashrc'
)
local link target
for link in "${!compat_symlinks[@]}"; do
target=${compat_symlinks["${link}"]}
dosym -r "${target}" "${link}"
if [[ "${target}" = /usr/share/flatcar/etc/* ]]; then
insinto "${target%/*}"
newins "${T}/empty-file" "${target##*/}"
fi
done
insinto '/etc/bash/bashrc.d'
doins "${FILESDIR}/99-flatcar-bcc"
}