mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-19 05:21:23 +02:00
app-alternatives/awk: Sync with Gentoo
It's from Gentoo commit d4c96a45f9e0c5401a6d4df4867dc85348fd7989.
This commit is contained in:
parent
fed5a37dec
commit
54dc427086
@ -3,53 +3,68 @@
|
|||||||
|
|
||||||
EAPI=8
|
EAPI=8
|
||||||
|
|
||||||
DESCRIPTION="/bin/awk and /usr/bin/awk symlinks"
|
ALTERNATIVES=(
|
||||||
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Base/Alternatives"
|
gawk:sys-apps/gawk
|
||||||
SRC_URI=""
|
busybox:sys-apps/busybox
|
||||||
S=${WORKDIR}
|
mawk:sys-apps/mawk
|
||||||
|
nawk:sys-apps/nawk
|
||||||
|
)
|
||||||
|
|
||||||
LICENSE="CC0-1.0"
|
inherit app-alternatives
|
||||||
SLOT="0"
|
|
||||||
|
DESCRIPTION="/bin/awk and /usr/bin/awk symlinks"
|
||||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||||
IUSE="busybox +gawk mawk nawk split-usr"
|
IUSE="split-usr"
|
||||||
REQUIRED_USE="^^ ( busybox gawk mawk nawk )"
|
|
||||||
|
|
||||||
RDEPEND="
|
RDEPEND="
|
||||||
busybox? ( sys-apps/busybox )
|
|
||||||
gawk? ( sys-apps/gawk )
|
|
||||||
mawk? ( sys-apps/mawk )
|
|
||||||
nawk? ( sys-apps/nawk )
|
|
||||||
!app-eselect/eselect-awk
|
!app-eselect/eselect-awk
|
||||||
"
|
"
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
local alt=$(get_alternative)
|
||||||
local root_prefix=
|
local root_prefix=
|
||||||
use split-usr && root_prefix=../../bin/
|
use split-usr && root_prefix=../../bin/
|
||||||
|
|
||||||
# We could consider setting AWK=... like we do for yacc & lex,
|
# We could consider setting AWK=... like we do for yacc & lex,
|
||||||
# but it would need some testing with a fair amount of packages first,
|
# but it would need some testing with a fair amount of packages first,
|
||||||
# as autoconf prefers gawk.
|
# as autoconf prefers gawk.
|
||||||
if use busybox; then
|
case ${alt} in
|
||||||
dosym "${root_prefix}busybox" /usr/bin/awk
|
busybox)
|
||||||
newman - awk.1 <<<".so busybox.1"
|
dosym "${root_prefix}busybox" /usr/bin/awk
|
||||||
elif use gawk; then
|
;;
|
||||||
dosym gawk /usr/bin/awk
|
*)
|
||||||
newman - awk.1 <<<".so gawk.1"
|
dosym "${alt}" /usr/bin/awk
|
||||||
elif use mawk; then
|
;;
|
||||||
dosym mawk /usr/bin/awk
|
esac
|
||||||
newman - awk.1 <<<".so mawk.1"
|
|
||||||
elif use nawk; then
|
newman - awk.1 <<<".so ${alt}.1"
|
||||||
dosym nawk /usr/bin/awk
|
|
||||||
newman - awk.1 <<<".so nawk.1"
|
|
||||||
else
|
|
||||||
die "Invalid USE flag combination (broken REQUIRED_USE?)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use split-usr; then
|
if use split-usr; then
|
||||||
dosym ../usr/bin/awk /bin/awk
|
dosym ../usr/bin/awk /bin/awk
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_preinst() {
|
||||||
|
local v
|
||||||
|
for v in ${REPLACING_VERSIONS}; do
|
||||||
|
# if we are upgrading from a new enough version, leftover manpage
|
||||||
|
# symlink cleanup was done already
|
||||||
|
if ver_test "${v}" -ge 3; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# otherwise, remove leftover files/symlinks created by eselect-awk (sic!)
|
||||||
|
shopt -s nullglob
|
||||||
|
local files=( "${EROOT}"/usr/share/man/man1/awk.1* )
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
|
if [[ ${files[@]} ]]; then
|
||||||
|
einfo "Cleaning up leftover manpage symlinks from eselect-awk ..."
|
||||||
|
rm -v "${files[@]}" || die
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
pkg_postrm() {
|
pkg_postrm() {
|
||||||
# make sure we don't leave the user without the symlinks, since
|
# make sure we don't leave the user without the symlinks, since
|
||||||
# they've not been owned by any other package
|
# they've not been owned by any other package
|
Loading…
x
Reference in New Issue
Block a user