mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-30 18:12:08 +02:00
eclass/alternatives: Sync with Gentoo
It's from Gentoo commit 8195a0e3dc65b66fd417f8cf5351ca78af4d4b5f.
This commit is contained in:
parent
b119831327
commit
6e3389c3f5
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2021 Gentoo Authors
|
# Copyright 1999-2022 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: alternatives.eclass
|
# @ECLASS: alternatives.eclass
|
||||||
@ -6,7 +6,7 @@
|
|||||||
# maintainer-needed@gentoo.org
|
# maintainer-needed@gentoo.org
|
||||||
# @AUTHOR:
|
# @AUTHOR:
|
||||||
# Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
|
# Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
|
||||||
# @SUPPORTED_EAPIS: 5 6 7
|
# @SUPPORTED_EAPIS: 7
|
||||||
# @BLURB: Creates symlink to the latest version of multiple slotted packages.
|
# @BLURB: Creates symlink to the latest version of multiple slotted packages.
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# When a package is SLOT'ed, very often we need to have a symlink to the
|
# When a package is SLOT'ed, very often we need to have a symlink to the
|
||||||
@ -42,12 +42,10 @@
|
|||||||
# consider using this unless you are want to do something special.
|
# consider using this unless you are want to do something special.
|
||||||
|
|
||||||
case ${EAPI} in
|
case ${EAPI} in
|
||||||
[5-7]) ;;
|
7) ;;
|
||||||
*) die "EAPI=${EAPI:-0} is not supported" ;;
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
EXPORT_FUNCTIONS pkg_postinst pkg_postrm
|
|
||||||
|
|
||||||
if [[ -z ${_ALTERNATIVES_ECLASS} ]]; then
|
if [[ -z ${_ALTERNATIVES_ECLASS} ]]; then
|
||||||
_ALTERNATIVES_ECLASS=1
|
_ALTERNATIVES_ECLASS=1
|
||||||
|
|
||||||
@ -95,8 +93,7 @@ alternatives_makesym() {
|
|||||||
# usage: alternatives_makesym <resulting symlink> [alternative targets..]
|
# usage: alternatives_makesym <resulting symlink> [alternative targets..]
|
||||||
# make sure it is in the prefix, allow it already to be in the prefix
|
# make sure it is in the prefix, allow it already to be in the prefix
|
||||||
SYMLINK=${EPREFIX}/${1#${EPREFIX}}
|
SYMLINK=${EPREFIX}/${1#${EPREFIX}}
|
||||||
# this trick removes the trailing / from ${ROOT}
|
pref=${ROOT}
|
||||||
pref=${ROOT%/}
|
|
||||||
shift
|
shift
|
||||||
ALTERNATIVES=$@
|
ALTERNATIVES=$@
|
||||||
|
|
||||||
@ -154,3 +151,5 @@ alternatives_pkg_postrm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
EXPORT_FUNCTIONS pkg_postinst pkg_postrm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user