summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-04-27 21:58:38 +0100
committerSam James <sam@gentoo.org>2024-04-28 00:09:49 +0100
commit3b57965e7f470622da200da16761f522e57c7991 (patch)
treea5bcc0f35d57de0e0127213a1d667b7eb7812929 /app-shells
parentnet-misc/croc: skip network related tests (diff)
downloadgentoo-3b57965e7f470622da200da16761f522e57c7991.tar.gz
gentoo-3b57965e7f470622da200da16761f522e57c7991.tar.bz2
gentoo-3b57965e7f470622da200da16761f522e57c7991.zip
app-shells/bash: prefixify bashrc.d files, whitelist st-256color, drop [ef]grep aliases
The ebuilds that install "${FILESDIR}/bashrc.d/10-gentoo-color.bash" were neglecting to prefixify it. That is, to replace instances of "/etc" with "${EPREFIX}/etc". After reviewing the prefix eclass, I found it to be wanting in all of its chief respects: interface, correctness, safety and robustness. Consequently, I rejected the notion of using it on principle. Instead, I elected to create a custom function, which is now used to prefixify both "bashrc" and "10-gentoo-color.bash". Among its virtues are that it writes an amended stream to the standard output, which may be directly processed by newins. Whitelist st-256color for Set Text Parameters support. Also, add it to the list of terminals known to support colour. Drop the egrep and fgrep aliases again. Previously, they had been dropped by Mike Gilbert but were inadvertently re-introduced through my being thorough rather than prudent. Given that both are non-standard, I certainly have no wish to provide users with any additional excuses for their continued use. Signed-off-by: Kerin Millar <kfm@plushkava.net> Fixes: 268b2e7c07d97bd9e833d239d786a0314c3b09ec Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/bash/bash-5.1_p16-r9.ebuild (renamed from app-shells/bash/bash-5.1_p16-r8.ebuild)14
-rw-r--r--app-shells/bash/bash-5.2_p26-r2.ebuild (renamed from app-shells/bash/bash-5.2_p26-r1.ebuild)14
-rw-r--r--app-shells/bash/bash-5.3_alpha-r1.ebuild (renamed from app-shells/bash/bash-5.3_alpha.ebuild)14
-rw-r--r--app-shells/bash/files/bashrc.d/10-gentoo-color.bash31
-rw-r--r--app-shells/bash/files/bashrc.d/10-gentoo-title.bash1
5 files changed, 53 insertions, 21 deletions
diff --git a/app-shells/bash/bash-5.1_p16-r8.ebuild b/app-shells/bash/bash-5.1_p16-r9.ebuild
index 41b73878797e..fefec1f7e54d 100644
--- a/app-shells/bash/bash-5.1_p16-r8.ebuild
+++ b/app-shells/bash/bash-5.1_p16-r9.ebuild
@@ -249,16 +249,26 @@ src_install() {
default
+ my_prefixify() {
+ while read -r; do
+ if [[ $REPLY == *$1* ]]; then
+ REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
+ fi
+ printf '%s\n' "${REPLY}" || ! break
+ done < "$2" || die
+ }
+
dodir /bin
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
dosym bash /bin/rbash
insinto /etc/bash
doins "${FILESDIR}"/bash_logout
- newins "$(prefixify_ro "${FILESDIR}"/bashrc-r1)" bashrc
+ my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
insinto /etc/bash/bashrc.d
- doins "${FILESDIR}"/bashrc.d/*.bash
+ my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
+ doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
insinto /etc/skel
for f in bash{_logout,_profile,rc} ; do
diff --git a/app-shells/bash/bash-5.2_p26-r1.ebuild b/app-shells/bash/bash-5.2_p26-r2.ebuild
index 0e803fa5048c..64cfa30c6113 100644
--- a/app-shells/bash/bash-5.2_p26-r1.ebuild
+++ b/app-shells/bash/bash-5.2_p26-r2.ebuild
@@ -296,16 +296,26 @@ src_install() {
default
+ my_prefixify() {
+ while read -r; do
+ if [[ $REPLY == *$1* ]]; then
+ REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
+ fi
+ printf '%s\n' "${REPLY}" || ! break
+ done < "$2" || die
+ }
+
dodir /bin
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
dosym bash /bin/rbash
insinto /etc/bash
doins "${FILESDIR}"/bash_logout
- newins "$(prefixify_ro "${FILESDIR}"/bashrc-r1)" bashrc
+ my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
insinto /etc/bash/bashrc.d
- doins "${FILESDIR}"/bashrc.d/*.bash
+ my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
+ doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
insinto /etc/skel
for f in bash{_logout,_profile,rc} ; do
diff --git a/app-shells/bash/bash-5.3_alpha.ebuild b/app-shells/bash/bash-5.3_alpha-r1.ebuild
index 036e48751a1f..9b535f0e39eb 100644
--- a/app-shells/bash/bash-5.3_alpha.ebuild
+++ b/app-shells/bash/bash-5.3_alpha-r1.ebuild
@@ -295,16 +295,26 @@ src_install() {
default
+ my_prefixify() {
+ while read -r; do
+ if [[ $REPLY == *$1* ]]; then
+ REPLY=${REPLY/"/etc/"/"${EPREFIX}/etc/"}
+ fi
+ printf '%s\n' "${REPLY}" || ! break
+ done < "$2" || die
+ }
+
dodir /bin
mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
dosym bash /bin/rbash
insinto /etc/bash
doins "${FILESDIR}"/bash_logout
- newins "$(prefixify_ro "${FILESDIR}"/bashrc-r1)" bashrc
+ my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc
insinto /etc/bash/bashrc.d
- doins "${FILESDIR}"/bashrc.d/*.bash
+ my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color.bash | newins - 10-gentoo-color.bash
+ doins "${FILESDIR}"/bashrc.d/10-gentoo-title.bash
insinto /etc/skel
for f in bash{_logout,_profile,rc} ; do
diff --git a/app-shells/bash/files/bashrc.d/10-gentoo-color.bash b/app-shells/bash/files/bashrc.d/10-gentoo-color.bash
index 5a6df5690c08..66afdcaa9557 100644
--- a/app-shells/bash/files/bashrc.d/10-gentoo-color.bash
+++ b/app-shells/bash/files/bashrc.d/10-gentoo-color.bash
@@ -14,20 +14,21 @@ elif unset -v COLORTERM; ! gentoo_color=$(tput colors 2>/dev/null); then
# and which remain (somewhat) popular. This will rarely happen, so the
# list need not be exhaustive.
case ${TERM} in
- *color* |\
- *direct* |\
- [Ekx]term* |\
- alacritty |\
- aterm |\
- dtterm |\
- foot* |\
- jfbterm |\
- linux |\
- mlterm |\
- rxvt* |\
- screen* |\
- tmux* |\
- wsvt25* ) gentoo_color=1
+ *color* |\
+ *direct* |\
+ [Ekx]term* |\
+ alacritty |\
+ aterm |\
+ dtterm |\
+ foot* |\
+ jfbterm |\
+ linux |\
+ mlterm |\
+ rxvt* |\
+ screen* |\
+ st-256color |\
+ tmux* |\
+ wsvt25* ) gentoo_color=1
esac
elif (( gentoo_color == 16777216 )); then
# Truecolor support is available. Advertise it.
@@ -47,7 +48,7 @@ fi
if (( gentoo_color > 0 )); then
# Colorize the output of grep and several coreutils utilities.
- for _ in diff dir egrep fgrep grep ls vdir; do
+ for _ in diff dir grep ls vdir; do
alias "$_=$_ --color=auto"
done
diff --git a/app-shells/bash/files/bashrc.d/10-gentoo-title.bash b/app-shells/bash/files/bashrc.d/10-gentoo-title.bash
index 56afcf213045..1fbf17c26327 100644
--- a/app-shells/bash/files/bashrc.d/10-gentoo-title.bash
+++ b/app-shells/bash/files/bashrc.d/10-gentoo-title.bash
@@ -45,6 +45,7 @@ case ${TERM} in
foot* |\
rxvt-unicode* |\
screen* |\
+ st-256color |\
tmux* |\
xterm* )
genfun_set_win_title() {