Hi,

Here is a patch proposal for this bug report. It aims :
- to be compatible with the install CD produced by debian-cd
- to avoid hard-coding a list of architectures in the Debian-Ports repository
- to make the use of the 'unreleased' distribution switchable.

I hope it will help to find a suitable solution !

Regards,
JH Chatenet


# This is a proposal to reopen bug #964248
# Running debootstrap on architectures from the debian-ports repository
# requires passing an option --extra-suites=unreleased
# (if installing from a debian-ports mirror)
#
# Experienced users may want to ignore the 'unreleased' distribution
# in some circumstances (e.g. installing from a custom mirror without
# 'unreleased'). This option is implemented here via a new debconf variable.
# To activate the option (and ignore 'unreleased') the user can either
# preseed the template 'base-installer/no_unreleased' to true or set
# the option at the boot prompt.
# The option is only intended for experienced users and is therefore not
# offered in a dialog. It can be either preseeded or set at the boot prompt.

diff -Naur a/base-installer-1.195/debian/bootstrap-base.postinst 
b/base-installer-1.195/debian/bootstrap-base.postinst
--- a/base-installer-1.195/debian/bootstrap-base.postinst       2020-07-05 
21:34:10.000000000 +0200
+++ b/base-installer-1.195/debian/bootstrap-base.postinst       2020-08-04 
12:25:06.527009301 +0200
@@ -96,8 +96,26 @@
        if [ "${EXCLUDES}" ]; then
                exclude="--exclude=${EXCLUDES}"
        fi
-       if is_ports_architecture "${ARCH}"; then
-               extra_suites="--extra-suites=unreleased"
+       if [ "$is_ports_architecture" != "1" ] || \
+               [ "$DISTRIBUTION" != "sid" ] && \
+               [ "$DISTRIBUTION" != "unstable" ]; then
+               # This is a released architecture : nothing to do
+               :
+       else
+               # This is an unreleased architecture in the Debian-Ports 
repository.
+               # 'unstable' is the only installable distribution.
+               # Installation from a debian-ports mirror may require packages 
from
+               # the 'unreleased' distribution too.
+               # There is no 'unreleased' distribution on install CD.
+               if [ "$PROTOCOL" = http ] || [ "$PROTOCOL" = https ] ||[ 
"$PROTOCOL" = ftp ]; then
+               # Did the user decline to consider the 'unreleased' 
distribution ?
+               # (e.g. if installing from a custom mirror without 'unreleased')
+                       if ! db_get base-installer/no_unreleased || [ "$RET" != 
true ]; then
+                               extra_suites="--extra-suites=unreleased"
+                       else
+                               log "As requested the 'unreleased' distribution 
is skipped"
+                       fi
+               fi
        fi
        sigcheck="--no-check-gpg"
        if [ "$PROTOCOL" = http ] || [ "$PROTOCOL" = ftp ]; then
diff -Naur a/base-installer-1.195/debian/bootstrap-base.templates 
b/base-installer-1.195/debian/bootstrap-base.templates
--- a/base-installer-1.195/debian/bootstrap-base.templates      2019-11-17 
22:17:31.000000000 +0100
+++ b/base-installer-1.195/debian/bootstrap-base.templates      2020-08-04 
12:17:13.288662639 +0200
@@ -452,3 +452,10 @@
 Type: string
 Description: for internal use; can be preseeded
  Force use of a specific debootstrap script
+
+Template: base-installer/no_unreleased
+Type: boolean
+Default: false
+Description: for internal use; can be preseeded
+ Do not consider packages from the unreleased distribution.
+
diff -Naur a/base-installer-1.195/library.sh b/base-installer-1.195/library.sh
--- a/base-installer-1.195/library.sh   2020-07-05 21:34:10.000000000 +0200
+++ b/base-installer-1.195/library.sh   2020-08-04 12:22:18.410175655 +0200
@@ -888,13 +888,9 @@
        rm -f "$KERNEL_LIST" "$KERNEL_LIST.unfiltered"
 }
 
-is_ports_architecture() {
-       case "$1" in
-               
alpha|hppa|hurd-i386|ia64|kfreebsd-amd64|kfreebsd-i386|m68k|powerpc|ppc64|riscv64|sh4|sparc64|x32)
-                       return 0
-                       ;;
-               *)
-                       return 1
-                       ;;
-       esac
-}
+is_ports_architecture=
+if [ -r /usr/lib/choose-mirror/port_architecture ]; then
+       log "Debian-Ports architecture detected"
+       is_ports_architecture=$(cat /usr/lib/choose-mirror/port_architecture)
+fi
+

Reply via email to