From 9f2a53c166b0fd91f950a04e1f2297fd350bb3cf Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 13 Jan 2023 18:33:08 +0900 Subject: [PATCH 1/2] 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 --- mk-sbuild | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/mk-sbuild b/mk-sbuild index e280fbb..fe166fe 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -397,29 +397,41 @@ fi # By default DEBOOTSTRAP_SCRIPT must match RELEASE DEBOOTSTRAP_SCRIPT="$RELEASE" -if [ "$DISTRO" = "ubuntu" ]; then - ubuntu_dist_ge() { - local releases="$(ubuntu-distro-info --all)" - local left=999 - local right=0 - local seq=1 - for i in $releases; do +dist_ge() { + local releases="$($3-distro-info --all)" + local left=999 + local right=0 + local seq=1 + + for i in $releases; do if [ $1 = $i ]; then - local left=$seq - break + local left=$seq + break fi seq=$((seq+1)) - done - seq=1 - for i in $releases; do + done + + seq=1 + for i in $releases; do if [ $2 = $i ]; then - local right=$seq - break + local right=$seq + break fi seq=$((seq+1)) - done - [ $left -ge $right ] && return 0 || return 1 - } + done + + [ $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 DEBOOTSTRAP_SCRIPT=gutsy fi From 69ac109cdbde5734d33c935b48aab3b477ac3901 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 13 Jan 2023 18:48:24 +0900 Subject: [PATCH 2/2] mk-sbuild: fix security update repository for Debian bullseye and later If I run "apt-get update" in the bullseye chroot, I get the following error: Err:4 http://security.debian.org bullseye-updates Release 404 Not Found [IP: 2a04:4e42:600::644 80] It looks like the directory path was changed since bullseye. buster: deb https://security.debian.org/debian-security buster/updates main bullseye: deb https://security.debian.org/debian-security bullseye-security main Signed-off-by: Masahiro Yamada --- mk-sbuild | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mk-sbuild b/mk-sbuild index fe166fe..52e15a1 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -675,7 +675,11 @@ debian) # Debian only performs security updates SKIP_UPDATES=1 if [ -z "$SOURCES_SECURITY_SUITE" ]; then - SOURCES_SECURITY_SUITE="RELEASE/updates" + if debian_dist_ge "$RELEASE" "bullseye"; then + SOURCES_SECURITY_SUITE="RELEASE-security" + else + SOURCES_SECURITY_SUITE="RELEASE/updates" + fi fi if [ -z "$SOURCES_SECURITY_URL" ]; then SOURCES_SECURITY_URL="http://security.debian.org/"