mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 17:06:58 +02:00
eclass/portability: Sync with gentoo
It's from gentoo commit 5eae2995e46c6dc23f85bd0839eb9a1028ebea91.
This commit is contained in:
parent
d692f0b456
commit
c6a76af95b
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2014 Gentoo Foundation
|
# Copyright 1999-2021 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: portability.eclass
|
# @ECLASS: portability.eclass
|
||||||
@ -6,14 +6,19 @@
|
|||||||
# base-system@gentoo.org
|
# base-system@gentoo.org
|
||||||
# @AUTHOR:
|
# @AUTHOR:
|
||||||
# Diego Pettenò <flameeyes@gentoo.org>
|
# Diego Pettenò <flameeyes@gentoo.org>
|
||||||
|
# @SUPPORTED_EAPIS: 5 6 7
|
||||||
# @BLURB: This eclass is created to avoid using non-portable GNUisms inside ebuilds
|
# @BLURB: This eclass is created to avoid using non-portable GNUisms inside ebuilds
|
||||||
|
|
||||||
|
case ${EAPI:-0} in
|
||||||
|
[567]) ;;
|
||||||
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ -z ${_PORTABILITY_ECLASS} ]]; then
|
if [[ -z ${_PORTABILITY_ECLASS} ]]; then
|
||||||
_PORTABILITY_ECLASS=1
|
_PORTABILITY_ECLASS=1
|
||||||
|
|
||||||
# @FUNCTION: treecopy
|
# @FUNCTION: treecopy
|
||||||
# @USAGE: <orig1> [orig2 orig3 ....] <dest>
|
# @USAGE: <orig1> [orig2 orig3 ....] <dest>
|
||||||
# @RETURN:
|
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# mimic cp --parents copy, but working on BSD userland as well
|
# mimic cp --parents copy, but working on BSD userland as well
|
||||||
treecopy() {
|
treecopy() {
|
||||||
@ -67,8 +72,8 @@ seq() {
|
|||||||
|
|
||||||
# Screw it, do the output ourselves
|
# Screw it, do the output ourselves
|
||||||
while :; do
|
while :; do
|
||||||
[[ $max < $min && $step > 0 ]] && break
|
[[ $max -lt $min && $step -gt 0 ]] && break
|
||||||
[[ $min < $max && $step < 0 ]] && break
|
[[ $min -lt $max && $step -gt 0 ]] && break
|
||||||
echo $min
|
echo $min
|
||||||
: $(( min += step ))
|
: $(( min += step ))
|
||||||
done
|
done
|
||||||
@ -118,7 +123,6 @@ get_bmake() {
|
|||||||
# @FUNCTION: get_mounts
|
# @FUNCTION: get_mounts
|
||||||
# @USAGE:
|
# @USAGE:
|
||||||
# @RETURN: table of mounts in form "point node fs opts"
|
# @RETURN: table of mounts in form "point node fs opts"
|
||||||
# @MAINTAINER:
|
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Portable method of getting mount names and points.
|
# Portable method of getting mount names and points.
|
||||||
# Returns as "point node fs options"
|
# Returns as "point node fs options"
|
||||||
|
Loading…
Reference in New Issue
Block a user