mk-sbuild: add debian_dist_ge()

Add debian_dist_ge(), which will be used by the next commit.

To avoid code duplication, move the common part to dist_ge().

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
This commit is contained in:
Masahiro Yamada 2023-01-13 18:33:08 +09:00
parent c1e4b14a98
commit 9f2a53c166

View File

@ -397,29 +397,41 @@ fi
# By default DEBOOTSTRAP_SCRIPT must match RELEASE # By default DEBOOTSTRAP_SCRIPT must match RELEASE
DEBOOTSTRAP_SCRIPT="$RELEASE" DEBOOTSTRAP_SCRIPT="$RELEASE"
if [ "$DISTRO" = "ubuntu" ]; then dist_ge() {
ubuntu_dist_ge() { local releases="$($3-distro-info --all)"
local releases="$(ubuntu-distro-info --all)" local left=999
local left=999 local right=0
local right=0 local seq=1
local seq=1
for i in $releases; do for i in $releases; do
if [ $1 = $i ]; then if [ $1 = $i ]; then
local left=$seq local left=$seq
break break
fi fi
seq=$((seq+1)) seq=$((seq+1))
done done
seq=1
for i in $releases; do seq=1
for i in $releases; do
if [ $2 = $i ]; then if [ $2 = $i ]; then
local right=$seq local right=$seq
break break
fi fi
seq=$((seq+1)) seq=$((seq+1))
done done
[ $left -ge $right ] && return 0 || return 1
} [ $left -ge $right ] && return 0 || return 1
}
ubuntu_dist_ge () {
dist_ge $1 $2 ubuntu
}
debian_dist_ge () {
dist_ge $1 $2 debian
}
if [ "$DISTRO" = "ubuntu" ]; then
# On Ubuntu, set DEBOOTSTRAP_SCRIPT to gutsy to allow building new RELEASES without new debootstrap # On Ubuntu, set DEBOOTSTRAP_SCRIPT to gutsy to allow building new RELEASES without new debootstrap
DEBOOTSTRAP_SCRIPT=gutsy DEBOOTSTRAP_SCRIPT=gutsy
fi fi