From da46e1a711520f9a0ca24ff2fa5cdc1cf7573176 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Sun, 28 Dec 2025 19:08:47 -0600 Subject: [PATCH 01/10] Use deb822 sources format everywhere --- chroot-script | 80 +++++++++++++++++++++++++++-------------- config | 18 +++++----- grml-debootstrap | 4 +-- grml-debootstrap.8.adoc | 9 ++--- 4 files changed, 71 insertions(+), 40 deletions(-) diff --git a/chroot-script b/chroot-script index 7c85e58f..bb35be0f 100755 --- a/chroot-script +++ b/chroot-script @@ -92,6 +92,34 @@ markauto() { } # }}} +# write a deb822 sources stanza to a file {{{ +writesource() { + local file types uris suites components signed_by + + file="${1:-}" + types="${2:-}" + uris="${3:-}" + suites="${4:-}" + components="${5:-}" + signed_by="${6:-}" + + mkdir -p "$(dirname "${file}")" + + if [ -f "$file" ]; then + ## stanzas need a space between them and the previous stanza + echo '' >> "$file" + fi + + echo "Types: $types" >> "$file" + echo "URIs: $uris" >> "$file" + echo "Suites: $suites" >> "$file" + echo "Components: $components" >> "$file" + if [ -n "$signed_by" ]; then + echo "Signed-By: $signed_by" >> "$file" + fi +} +# }}} + # define chroot mirror {{{ chrootmirror() { if [ "$KEEP_SRC_LIST" = "yes" ] ; then @@ -105,8 +133,16 @@ chrootmirror() { echo "Using repository components $COMPONENTS" if [ -n "$MIRROR" ] ; then - echo "Adjusting sources.list for mirror (${MIRROR})." - echo "deb $MIRROR $RELEASE $COMPONENTS" > /etc/apt/sources.list + echo "Deleting obsolete sources.list" + rm -f /etc/apt/sources.list + + if grep -q 'file:' <<< "$MIRROR" ; then + echo "Adjusting sources.list.d/local.sources for mirror (${MIRROR})." + writesource '/etc/apt/sources.list.d/local.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + else + echo "Adjusting sources.list.d/debian.sources for mirror (${MIRROR})." + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + fi fi # add security.debian.org: @@ -115,8 +151,8 @@ chrootmirror() { *) # bullseye and newer releases use a different repository layout, see # https://lists.debian.org/debian-devel-announce/2019/07/msg00004.html - echo "Adding security.debian.org/debian-security to sources.list." - echo "deb http://security.debian.org/debian-security ${RELEASE}-security $COMPONENTS" >> /etc/apt/sources.list + echo "Adding security.debian.org/debian-security to sources.list.d/debian.sources." + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' ;; esac } @@ -130,11 +166,10 @@ remove_chrootmirror() { fi if [ -n "$MIRROR" ] && echo "$MIRROR" | grep -q 'file:' ; then - echo "Removing local mirror (${MIRROR}) from sources.list." - TMP_MIRROR="${MIRROR//\//\\\/}" - sed -i "/deb $TMP_MIRROR $RELEASE $COMPONENTS/ D" /etc/apt/sources.list - echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to sources.list instead." - echo "deb $FALLBACK_MIRROR $RELEASE $COMPONENTS" >> /etc/apt/sources.list + echo "Removing local.sources." + rm /etc/apt/sources.list.d/local.sources + echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to sources.list.d/debian.sources instead." + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi } # }}} @@ -146,19 +181,15 @@ grmlrepos() { fi # user might have provided their own apt sources configuration - if [ -r /etc/apt/sources.list.d/grml.list ] ; then - echo "File /etc/apt/sources.list.d/grml.list exists already, not modifying." + if [ -r /etc/apt/sources.list.d/grml.sources ] ; then + echo "File /etc/apt/sources.list.d/grml.sources exists already, not modifying." else - echo "Setting up /etc/apt/sources.list.d/grml.list." - cat > /etc/apt/sources.list.d/grml.list << EOF -# grml: stable repository: - deb [signed-by=/usr/share/keyrings/grml-archive-keyring.gpg] http://deb.grml.org/ grml-stable main - deb-src [signed-by=/usr/share/keyrings/grml-archive-keyring.gpg] http://deb.grml.org/ grml-stable main - -# grml: testing/development repository: - deb [signed-by=/usr/share/keyrings/grml-archive-keyring.gpg] http://deb.grml.org/ grml-testing main - deb-src [signed-by=/usr/share/keyrings/grml-archive-keyring.gpg] http://deb.grml.org/ grml-testing main -EOF + echo "Setting up /etc/apt/sources.list.d/grml.sources." + echo '# grml: stable repository:' >> /etc/apt/sources.list.d/grml.sources + writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-stable' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' + echo '' >> /etc/apt/sources.list.d/grml.sources + echo '# grml: testing/development repository:' >> /etc/apt/sources.list.d/grml.sources + writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-testing' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' fi # make sure we install packages from Grml's pool only if not available from Debian @@ -188,11 +219,8 @@ EOF # feature to provide Debian backports repos {{{ backportrepos() { if [ -n "$BACKPORTREPOS" ] ; then - cat >> /etc/apt/sources.list.d/backports.list << EOF -# debian backports: ${RELEASE}-backports repository: -deb ${MIRROR} ${RELEASE}-backports main -deb-src ${MIRROR} ${RELEASE}-backports main -EOF + echo "# debian backports: ${RELEASE}-backports repository:" >> /etc/apt/sources.list.d/backports.sources + writesource '/etc/apt/sources.list.d/backports.sources' 'deb deb-src' "$MIRROR" "${RELEASE}-backports" 'main' '/usr/share/keyrings/debian-archive-keyring.gpg' fi } # }}} diff --git a/config b/config index 450582f1..3e19bdf8 100644 --- a/config +++ b/config @@ -41,17 +41,19 @@ # BOOT_APPEND='pci=nomsi' # Set mirror where packages will be downloaded from. -# Default: use /etc/debootstrap/etc/apt/sources.list if it exists, else -# 'http://deb.debian.org/debian' +# Default: use /etc/debootstrap/etc/apt/sources.list.d/debian.sources if it +# exists, else use /etc/debootstrap/etc/apt/sources.list if it exists, else +# use 'http://deb.debian.org/debian' # Usage example: # MIRROR='ftp://ftp.de.debian.org/debian' -# If /etc/apt/sources.list should NOT be build on the fly, this -# options allows providing a separate apt sources.list file via -# /etc/debootstrap/etc/apt/sources.list +# If /etc/apt/sources.list.d/debian.sources should NOT be built on the fly, +# this option allows providing a separate apt sources.list file via +# /etc/debootstrap/etc/apt/sources.list, or providing a deb822-format sources +# file via /etc/debootstrap/etc/apt/sources.list.d/debian.sources. # KEEP_SRC_LIST='yes' -# To enable the Grml repository via /etc/apt/sources.list.d/grml.list +# To enable the Grml repository via /etc/apt/sources.list.d/grml.sources # set this variable to 'yes'. # Default: 'no' # GRMLREPOS='yes' @@ -62,7 +64,7 @@ # GRMLPACKAGES='grml-etc-core' # To enable Debian's backports repository via -# /etc/apt/sources.list.d/backports.list set this variable to 'yes'. +# /etc/apt/sources.list.d/backports.sources set this variable to 'yes'. # Default: 'no' # BACKPORTREPOS='yes' @@ -71,7 +73,7 @@ # Default: 'trixie' # RELEASE='trixie' -# Define components that should be used within sources.list. +# Define components that should be used within sources.list.d/debian.sources. # Default: 'main' # COMPONENTS='main contrib non-free' diff --git a/grml-debootstrap b/grml-debootstrap index f4288e3b..d06afeb9 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -139,7 +139,7 @@ Configuration options: --debconf Pre-seed packages using specified pre-seed db file. --grmlrepos Enable Grml's Debian repository (deb.grml.org). --backportrepos Enable Debian's backports repository (backports.debian.org). - --keep_src_list Do not overwrite user provided apt sources.list. + --keep_src_list Do not override user provided apt sources. --contrib Enable 'contrib' in COMPONENTS (defaults to 'main' only). --non-free Enable non-free / non-free-firmware in COMPONENTS (defaults to 'main' only). --hostname Hostname of Debian system. @@ -461,7 +461,7 @@ while :; do shift; _opt_chroot_scripts="$1" _opt_chroot_scripts_set=T ;; - --keep_src_list) # Do not overwrite user provided apt sources.list + --keep_src_list) # Do not override user provided apt sources _opt_keep_src_list=T ;; --hostname) # Hostname of Debian system diff --git a/grml-debootstrap.8.adoc b/grml-debootstrap.8.adoc index d9b98789..92e74b94 100644 --- a/grml-debootstrap.8.adoc +++ b/grml-debootstrap.8.adoc @@ -40,8 +40,8 @@ Options and environment variables *--backportrepos*:: Enable Debian's Backports repository via the - /etc/apt/sources.list.d/backports.list configuration file. This provides the - option to install Debian packages from Debian's backports repository. + /etc/apt/sources.list.d/backports.sources configuration file. This provides + the option to install Debian packages from Debian's backports repository. *--bootappend* _appendline-for-the-kernel_:: @@ -113,7 +113,7 @@ Options and environment variables *--grmlrepos*:: Enable Grml.org's Debian repository (http://deb.grml.org/) via the - /etc/apt/sources.list.d/grml.list configuration file. This provides the + /etc/apt/sources.list.d/grml.sources configuration file. This provides the option to install Debian packages from Grml's repository. *--grub* _device_:: @@ -135,7 +135,8 @@ Options and environment variables *--keep_src_list*:: - Do not overwrite user provided /etc/apt/sources.list. + Do not override user provided /etc/apt/sources.list.d/debian.sources or + delete /etc/apt/sources.list. *-m*, *--mirror* _URL_:: From 0ee1df8a6dd3e1aea172934662622f0bbe2c4592 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 02:45:29 +0100 Subject: [PATCH 02/10] reduce usage of pipes and add optional comment to writesource() --- chroot-script | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/chroot-script b/chroot-script index bb35be0f..f45bc740 100755 --- a/chroot-script +++ b/chroot-script @@ -96,12 +96,13 @@ markauto() { writesource() { local file types uris suites components signed_by - file="${1:-}" + file=/etc/apt/sources.list.d/"${1?}".sources types="${2:-}" uris="${3:-}" suites="${4:-}" components="${5:-}" signed_by="${6:-}" + comment="${7:-}" mkdir -p "$(dirname "${file}")" @@ -110,13 +111,19 @@ writesource() { echo '' >> "$file" fi - echo "Types: $types" >> "$file" - echo "URIs: $uris" >> "$file" - echo "Suites: $suites" >> "$file" - echo "Components: $components" >> "$file" + { + if [ -n "$comment" ]; then + echo "# $comment" + fi + echo "Types: $types" + echo "URIs: $uris" + echo "Suites: $suites" + echo "Components: $components" if [ -n "$signed_by" ]; then - echo "Signed-By: $signed_by" >> "$file" + echo "Signed-By: $signed_by" fi + echo + } >> "$file" } # }}} @@ -138,10 +145,10 @@ chrootmirror() { if grep -q 'file:' <<< "$MIRROR" ; then echo "Adjusting sources.list.d/local.sources for mirror (${MIRROR})." - writesource '/etc/apt/sources.list.d/local.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource 'local' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' else echo "Adjusting sources.list.d/debian.sources for mirror (${MIRROR})." - writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource 'debian' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi fi @@ -152,7 +159,7 @@ chrootmirror() { # bullseye and newer releases use a different repository layout, see # https://lists.debian.org/debian-devel-announce/2019/07/msg00004.html echo "Adding security.debian.org/debian-security to sources.list.d/debian.sources." - writesource '/etc/apt/sources.list.d/debian.sources' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource 'debian' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' ;; esac } @@ -167,9 +174,9 @@ remove_chrootmirror() { if [ -n "$MIRROR" ] && echo "$MIRROR" | grep -q 'file:' ; then echo "Removing local.sources." - rm /etc/apt/sources.list.d/local.sources + rm local.sources echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to sources.list.d/debian.sources instead." - writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource 'debian' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi } # }}} @@ -181,15 +188,12 @@ grmlrepos() { fi # user might have provided their own apt sources configuration - if [ -r /etc/apt/sources.list.d/grml.sources ] ; then - echo "File /etc/apt/sources.list.d/grml.sources exists already, not modifying." + if [ -r grml.sources ] ; then + echo "File grml.sources exists already, not modifying." else - echo "Setting up /etc/apt/sources.list.d/grml.sources." - echo '# grml: stable repository:' >> /etc/apt/sources.list.d/grml.sources - writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-stable' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' - echo '' >> /etc/apt/sources.list.d/grml.sources - echo '# grml: testing/development repository:' >> /etc/apt/sources.list.d/grml.sources - writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-testing' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' + echo "Setting up grml.sources." + writesource 'grml' 'deb deb-src' 'https://deb.grml.org' 'grml-stable' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: stable repository:' + writesource 'grml' 'deb deb-src' 'https://deb.grml.org' 'grml-testing' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: testing/development repository:' fi # make sure we install packages from Grml's pool only if not available from Debian @@ -219,8 +223,7 @@ EOF # feature to provide Debian backports repos {{{ backportrepos() { if [ -n "$BACKPORTREPOS" ] ; then - echo "# debian backports: ${RELEASE}-backports repository:" >> /etc/apt/sources.list.d/backports.sources - writesource '/etc/apt/sources.list.d/backports.sources' 'deb deb-src' "$MIRROR" "${RELEASE}-backports" 'main' '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource 'backports' 'deb deb-src' "$MIRROR" "${RELEASE}-backports" 'main' '/usr/share/keyrings/debian-archive-keyring.gpg' "debian backports: ${RELEASE}-backports repository:" fi } # }}} From f990affbf6f5a7f85ba916a566b0d71bfd199d7f Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 02:52:42 +0100 Subject: [PATCH 03/10] less fiif --- chroot-script | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/chroot-script b/chroot-script index f45bc740..b243caf0 100755 --- a/chroot-script +++ b/chroot-script @@ -112,16 +112,12 @@ writesource() { fi { - if [ -n "$comment" ]; then - echo "# $comment" - fi + [ -n "$comment" ] && echo "# $comment" echo "Types: $types" echo "URIs: $uris" echo "Suites: $suites" echo "Components: $components" - if [ -n "$signed_by" ]; then - echo "Signed-By: $signed_by" - fi + [ -n "$signed_by" ] && echo "Signed-By: $signed_by" echo } >> "$file" } From 8c082873a5c62962435c9bd749351af1517dc5f2 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 03:05:03 +0100 Subject: [PATCH 04/10] only add empty line if needed --- chroot-script | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chroot-script b/chroot-script index b243caf0..877213c7 100755 --- a/chroot-script +++ b/chroot-script @@ -104,11 +104,11 @@ writesource() { signed_by="${6:-}" comment="${7:-}" - mkdir -p "$(dirname "${file}")" + mkdir -p "${file%/*}" || exit 73 - if [ -f "$file" ]; then + if [ -f "$file" ] && [ "$(tail -n 1 "$file")" = '' ]; then ## stanzas need a space between them and the previous stanza - echo '' >> "$file" + echo >> "$file" fi { From 2efee7388762d244076b27b972e64376380b1b8d Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 03:18:20 +0100 Subject: [PATCH 05/10] undo nonsense --- chroot-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chroot-script b/chroot-script index 877213c7..605c294f 100755 --- a/chroot-script +++ b/chroot-script @@ -184,7 +184,7 @@ grmlrepos() { fi # user might have provided their own apt sources configuration - if [ -r grml.sources ] ; then + if [ -r /etc/apt/sources.list.d/grml.sources ] ; then echo "File grml.sources exists already, not modifying." else echo "Setting up grml.sources." From 90d437eb910df85d115553da6f862f709cc98535 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 03:30:22 +0100 Subject: [PATCH 06/10] is klar --- chroot-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chroot-script b/chroot-script index 605c294f..881a7a75 100755 --- a/chroot-script +++ b/chroot-script @@ -106,7 +106,7 @@ writesource() { mkdir -p "${file%/*}" || exit 73 - if [ -f "$file" ] && [ "$(tail -n 1 "$file")" = '' ]; then + if [ -f "$file" ] && [ "$(tail -n 1 "$file")" != '' ]; then ## stanzas need a space between them and the previous stanza echo >> "$file" fi From d35e8217144e23f6de7979dda67dd97740ef2524 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 03:37:58 +0100 Subject: [PATCH 07/10] sources.list.d wahn --- chroot-script | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chroot-script b/chroot-script index 881a7a75..c95bd6f5 100755 --- a/chroot-script +++ b/chroot-script @@ -140,10 +140,10 @@ chrootmirror() { rm -f /etc/apt/sources.list if grep -q 'file:' <<< "$MIRROR" ; then - echo "Adjusting sources.list.d/local.sources for mirror (${MIRROR})." + echo "Adjusting local.sources for mirror (${MIRROR})." writesource 'local' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' else - echo "Adjusting sources.list.d/debian.sources for mirror (${MIRROR})." + echo "Adjusting debian.sources for mirror (${MIRROR})." writesource 'debian' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi fi @@ -154,7 +154,7 @@ chrootmirror() { *) # bullseye and newer releases use a different repository layout, see # https://lists.debian.org/debian-devel-announce/2019/07/msg00004.html - echo "Adding security.debian.org/debian-security to sources.list.d/debian.sources." + echo "Adding security.debian.org/debian-security to debian.sources." writesource 'debian' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' ;; esac @@ -170,8 +170,8 @@ remove_chrootmirror() { if [ -n "$MIRROR" ] && echo "$MIRROR" | grep -q 'file:' ; then echo "Removing local.sources." - rm local.sources - echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to sources.list.d/debian.sources instead." + rm /etc/apt/sources.list.d/local.sources + echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to debian.sources instead." writesource 'debian' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi } From eb829dc450324a2438240ecf8564b1217b1e4721 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 03:42:25 +0100 Subject: [PATCH 08/10] Disable snapshots for grml-repos!!! --- chroot-script | 1 + 1 file changed, 1 insertion(+) diff --git a/chroot-script b/chroot-script index c95bd6f5..fc8cfa95 100755 --- a/chroot-script +++ b/chroot-script @@ -118,6 +118,7 @@ writesource() { echo "Suites: $suites" echo "Components: $components" [ -n "$signed_by" ] && echo "Signed-By: $signed_by" + [ "${suites%-*}" = 'grml' ] && echo "Snapshot: disable" echo } >> "$file" } From bf73b8e8e74c962da58848842d9cff7534157c35 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 11:52:44 +0100 Subject: [PATCH 09/10] =?UTF-8?q?z=C3=A4ha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chroot-script | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/chroot-script b/chroot-script index fc8cfa95..471485e5 100755 --- a/chroot-script +++ b/chroot-script @@ -96,7 +96,7 @@ markauto() { writesource() { local file types uris suites components signed_by - file=/etc/apt/sources.list.d/"${1?}".sources + file="${1:-}" types="${2:-}" uris="${3:-}" suites="${4:-}" @@ -142,10 +142,10 @@ chrootmirror() { if grep -q 'file:' <<< "$MIRROR" ; then echo "Adjusting local.sources for mirror (${MIRROR})." - writesource 'local' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource '/etc/apt/sources.list.d/local.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' else echo "Adjusting debian.sources for mirror (${MIRROR})." - writesource 'debian' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi fi @@ -156,7 +156,7 @@ chrootmirror() { # bullseye and newer releases use a different repository layout, see # https://lists.debian.org/debian-devel-announce/2019/07/msg00004.html echo "Adding security.debian.org/debian-security to debian.sources." - writesource 'debian' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' 'http://security.debian.org/debian-security' "${RELEASE}-security" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' ;; esac } @@ -173,7 +173,7 @@ remove_chrootmirror() { echo "Removing local.sources." rm /etc/apt/sources.list.d/local.sources echo "Adding fallback mirror entry (${FALLBACK_MIRROR}) to debian.sources instead." - writesource 'debian' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' + writesource '/etc/apt/sources.list.d/debian.sources' 'deb' "$FALLBACK_MIRROR" "$RELEASE" "$COMPONENTS" '/usr/share/keyrings/debian-archive-keyring.gpg' fi } # }}} @@ -189,8 +189,8 @@ grmlrepos() { echo "File grml.sources exists already, not modifying." else echo "Setting up grml.sources." - writesource 'grml' 'deb deb-src' 'https://deb.grml.org' 'grml-stable' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: stable repository:' - writesource 'grml' 'deb deb-src' 'https://deb.grml.org' 'grml-testing' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: testing/development repository:' + writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-stable' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: stable repository:' + writesource '/etc/apt/sources.list.d/grml.sources' 'deb deb-src' 'https://deb.grml.org' 'grml-testing' 'main' '/usr/share/keyrings/grml-archive-keyring.gpg' 'grml: testing/development repository:' fi # make sure we install packages from Grml's pool only if not available from Debian @@ -220,7 +220,7 @@ EOF # feature to provide Debian backports repos {{{ backportrepos() { if [ -n "$BACKPORTREPOS" ] ; then - writesource 'backports' 'deb deb-src' "$MIRROR" "${RELEASE}-backports" 'main' '/usr/share/keyrings/debian-archive-keyring.gpg' "debian backports: ${RELEASE}-backports repository:" + writesource '/etc/apt/sources.list.d/backports.sources' 'deb deb-src' "$MIRROR" "${RELEASE}-backports" 'main' '/usr/share/keyrings/debian-archive-keyring.gpg' "debian backports: ${RELEASE}-backports repository:" fi } # }}} From 8c4390d68b69b0eeb9ea2c5ec67f52b2afae6f65 Mon Sep 17 00:00:00 2001 From: Christopher Bock Date: Mon, 29 Dec 2025 11:57:30 +0100 Subject: [PATCH 10/10] run mkdir for sourcepart once --- chroot-script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chroot-script b/chroot-script index 471485e5..816fb9bb 100755 --- a/chroot-script +++ b/chroot-script @@ -35,6 +35,8 @@ bash -n /etc/debootstrap/variables [ -r /proc/1 ] || mount -t proc none /proc [ -r /sys/kernel ] || mount -t sysfs none /sys +mkdir -p /etc/apt/sources.list.d || exit 73 + # variable checks {{{ # use aptitude only if it's available @@ -104,8 +106,6 @@ writesource() { signed_by="${6:-}" comment="${7:-}" - mkdir -p "${file%/*}" || exit 73 - if [ -f "$file" ] && [ "$(tail -n 1 "$file")" != '' ]; then ## stanzas need a space between them and the previous stanza echo >> "$file"