[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#811243: base-installer: shouldn't assume that file protocol is only used for CD (image) installs



Control: tag -1 patch

Hi Cyril,

On Sun, 17 Jan 2016 at 09:57:27 +0100, Cyril Brulebois wrote:
> No need to set this tag for packages maintained by debian-boot. ;)

I wasn't sure; thanks for confirming this :-P

> [ Only skimming over the bug report for now, lacking time to double
> check everything and commit/test a fix… sorry about that. ]

No worries!

> Nothing obvious to me looking at git log. One would have to dig earlier
> than when fuctions were introduced in base-installer since this
> assumption was already there to begin with. The kind of change you're
> proposing seems rather reasonable to me at first glance.

It might be due to debootstrap, which doesn't understand cdrom:// URIs.

> Having file:// as mirror URI looks like a reasonable/valid use case to
> me, we should fix support for it.

Great!  I tried the two attached patches: they both work fine for me,
but I've not tried other installation setups.  I think it's cleaner to
set PROTOCOL="cdrom", but the other patch is less invasive.

Cheers,
-- 
Guilhem.
From f4b259baf5a26d0960b7295f4390b9bf9f61f755 Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@guilhem.org>
Date: Mon, 18 Jan 2016 17:23:23 +0100
Subject: [PATCH] Avoid calling apt-cdrom(8) on file:// mirrors.

---
 library.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library.sh b/library.sh
index d73d880..cdece40 100644
--- a/library.sh
+++ b/library.sh
@@ -804,7 +804,7 @@ install_kernel() {
 
 # Assumes the file protocol is only used for CD (image) installs
 configure_apt () {
-	if [ "$PROTOCOL" = file ]; then
+	if [ "$PROTOCOL" = file ] && [ -f /cdrom/.disk/base_installable ]; then
 		local tdir=/target/media$DIRECTORY
 		rm -f /var/lib/install-cd.id
 
-- 
2.7.0.rc3

From d7f82a5071316ca222bd08534a81dad574e6ee93 Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@guilhem.org>
Date: Mon, 18 Jan 2016 17:25:10 +0100
Subject: [PATCH] Set PROTOCOL=cdrom for cdrom:// URIs (except for
 debootstrap).

---
 debian/bootstrap-base.postinst | 5 +++--
 library.sh                     | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/bootstrap-base.postinst b/debian/bootstrap-base.postinst
index ed2e0ab..e0163e6 100755
--- a/debian/bootstrap-base.postinst
+++ b/debian/bootstrap-base.postinst
@@ -123,10 +123,11 @@ install_base_system () {
 	# clean up after any past debootstrap run
 	rm -f /target/var/lib/apt/* 2>/dev/null || true
 
-	local debootstrap_failed=
+	local debootstrap_failed= debootstrap_protocol="$PROTOCOL"
 	if search-path cdebootstrap; then
 		cdebootstrap || debootstrap_failed=$?
 	else
+		[ "$debootstrap_protocol" != cdrom ] || debootstrap_protocol=file
 		log-output -t debootstrap run-debootstrap \
 			--components="${COMPONENTS}" \
 			--debian-installer \
@@ -135,7 +136,7 @@ install_base_system () {
 			${sigcheck} \
 			${DEBOOTSTRAP_VARIANT} \
 			${DISTRIBUTION} /target \
-			"$PROTOCOL://$MIRROR$DIRECTORY" \
+			"$debootstrap_protocol://$MIRROR$DIRECTORY" \
 			${DEBOOTSTRAP_SCRIPT} \
 			|| debootstrap_failed=$?
 	fi
diff --git a/library.sh b/library.sh
index d73d880..89f6d9f 100644
--- a/library.sh
+++ b/library.sh
@@ -303,7 +303,7 @@ get_mirror_info () {
 			exit_error base-installer/no_codename
 		fi
 
-		PROTOCOL=file
+		PROTOCOL=cdrom
 		MIRROR=""
 		DIRECTORY="/cdrom/"
 		if [ -s /cdrom/.disk/base_components ]; then
@@ -804,7 +804,7 @@ install_kernel() {
 
 # Assumes the file protocol is only used for CD (image) installs
 configure_apt () {
-	if [ "$PROTOCOL" = file ]; then
+	if [ "$PROTOCOL" = cdrom ]; then
 		local tdir=/target/media$DIRECTORY
 		rm -f /var/lib/install-cd.id
 
-- 
2.7.0.rc3

Attachment: signature.asc
Description: PGP signature


Reply to: